org.hibernate.HibernateException: save is not valid without active transaction

This issue had caused me lots of troubles in my projects. Finally I have found out the main reason is that in spring application context within session factory definition you need to remove hibernate.current_session_context_class entry the below is full code

Projects tested Spring 3 Hibernate 3 and 4

<!– Hibernate configuration settings –>
<bean id=”sessionFactory”
<property name=”dataSource” ref=”dataSource” />
<property name=”packagesToScan” value=”com.tugrulaslan.domain” />
<property name=”hibernateProperties”>
<prop key=”hibernate.dialect”>${orm.dialect}</prop>
<prop key=”hibernate.pool_size”>”${orm.pool_size}</prop>
<prop key=”hibernate.show_sql”>${orm.show_sql}</prop>
<prop key=””>${}</prop>

Leave a Reply

Your email address will not be published. Required fields are marked *