title: no transaction is in progress since spring migration to 4.3.3
body: <p>I am facing an issue and I can't seem to find a solution.</p>
  
  <p>I am migrating a project from Hibernate 5.1.1 to 5.2.2 and Spring from 4.1.0 to 4.3.3.</p>
  
  <p>Using weblogic, when I try to deploy my ear I get a TransactionRequiredException: no transaction is in progress.</p>
  
  <p>This happens on a bean that is supposed to make a lot of queries to the database, and the method is annotated @PostConstruct.</p>
  
  <p>It was working fine before, I updated my hibernate configuration according to the migration guide and I can't seem to find the solution.</p>
  
  <p>This is the modified configuration for Hibernate 5.2.2 :</p>
  
  <pre><code>&lt;prop key="hibernate.transaction.coordinator_class"&gt;jta&lt;/prop&gt;
  &lt;!-- How to produce transaction --&gt;
  &lt;prop      key="hibernate.transaction.jta.platform"&gt;org.hibernate.service.jta.platform.internal.WeblogicJtaPlatform&lt;/prop&gt;
  </code></pre>
  
  <p>This is an extract of the server log :</p>
  
  <pre><code>Caused by: javax.persistence.TransactionRequiredException: no transaction is in progress
     at org.hibernate.internal.SessionImpl.checkTransactionNeeded(SessionImpl.java:3428) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
     at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1395) [hibernate-core-5.2.2.Final.jar:5.2.2.Final]
     at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1391) ~[hibernate-core-5.2.2.Final.jar:5.2.2.Final]
     at org.springframework.orm.hibernate5.SessionFactoryUtils.flush(SessionFactoryUtils.java:144) ~[spring-orm-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.orm.hibernate5.SpringSessionSynchronization.beforeCommit(SpringSessionSynchronization.java:95) ~[spring-orm-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95) ~[spring-tx-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:932) ~[spring-tx-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:744) ~[spring-tx-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730) ~[spring-tx-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:487) ~[spring-tx-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291) ~[spring-tx-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at com.sun.proxy.$Proxy408.findAll(Unknown Source) ~[?:?]
  </code></pre>
  
  <p>It was working fine before my migration attempt and I suppose it is related to the fact that the bean is initialized but the transaction is closed.</p>
  
  <p>What is strange is that when I debug the method, I am able to get the first few calls to the database but it fails later on.</p>
  
  <p>In both cases I am using :</p>
  
  <pre><code>getHibernateTemplate().executeWithNativeSession(new HibernateCallback&lt;List&lt;E&gt;&gt;()
  </code></pre>
  
  <p>Has anyone of you encountered this kind of problem?</p>
  
  <p>I googled days long and I can't find a single answer corresponding to this problem (btw. this also happens on my Junit tests)</p>
  
  <p>Thanks in advance for your help.</p>
  
  <p>Cheers!</p>