I have an abstract base DAO that uses HibernateTemplates for data access. I'm a little confused as to where I should be configuring transaction management. Should I be configuring it with my Hibernate properties like this:
or should I be attaching a HibernateTransactionManager to the session factory like this:Code:<bean id="hibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="properties"> <props> <prop key="hibernate.dialect">net.sf.hibernate.dialect.SQLServerDialect</prop> <prop key="hibernate.query.substitutions">true 1, false 0</prop> <prop key="hibernate.show_sql">false</prop> <prop key="hibernate.use_outer_join">true</prop> <prop key="hibernate.cache.provider_class">net.sf.hibernate.cache.EhCacheProvider</prop> <prop key="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</prop> </props> </property> </bean>
If the second method is correct will this automagically use transaction management where necessary or do I need to apply additional configurations?Code:<bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean>


Reply With Quote