Reputation: 23
I am trying to upgrade spring version(4.3) and hibernate version(5.4) and I am getting 'no transaction is in progress' exception, I am using HibernateTransactionManager and also I have tried with setting hibernate.transaction.coordinator_class to 'jta' as well as 'jdbc'. my configs are below
<bean id="MyTransactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="myAppSessionFactory"/>
</bean>
<bean id="myAppSessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean" lazy-init="true">
<property name="mappingLocations">
<list>
<value>classpath:/mappings/UserGroupMembershipPOJO.hbm.xml</value>
<value>classpath:/mappings/UserGroupPOJO.hbm.xml</value>
<value>classpath:/mappings/UserDetailsPOJO.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.use_outer_join">false</prop>
<prop key="hibernate.jdbc.fetch_size">5</prop>
<prop key="hibernate.jdbc.batch_size">0</prop>
<prop key="hibernate.transaction.coordinator_class">jta</prop>
</props>
</property>
<property name="dataSource">
<ref bean="myDataSource"/>
</property>
</bean>
Upvotes: 1
Views: 2217
Reputation: 1654
Hibernate now conforms with the JPA specification to not allow flushing updates outside of a transaction boundary. To restore 5.1 behavior, allowing flush operations outside of a transaction boundary, set hibernate.allow_update_outside_transaction=true.
hibernate-orm/migration-guide.adoc at 5.2 · hibernate/hibernate-orm
Upvotes: 5