In addition to the @LakatosGyula answer , if using Hibernate with Spring this configuration will do the job:
<tx:annotation-driven transaction-manager="txManager"/> <bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"/> </bean>
source share