javax.persistence.TransactionRequiredException: no transaction is in progress

Stack Overflow | dermoritz | 3 months ago
  1. 0

    camel-jpa "no transaction is in progress"

    Stack Overflow | 3 months ago | dermoritz
    javax.persistence.TransactionRequiredException: no transaction is in progress
  2. 0

    Hibernate 5.2.0 changed the method signature for Session.getFlushMode() so that it returns a javax.persistence.FlushModeType instead of a org.hibernate.FlushMode Spring 4.3.0 introduced several changes so that it could remain compatible with both 5.1.0 and 5.2.0 mainly by introducing indirection to obtain the Hibernate flush mode through SessionFactoryUtils.getFlushMode(session). However, this necessary change was omitted from SpringSessionSynchronization which still uses the following code snippet in beforeCommit(): if (!session.getFlushMode().equals(FlushMode.MANUAL)) { ... } which should now be: FlushMode flushMode = SessionFactoryUtils.getFlushMode(session); if (FlushMode.MANUAL.equals(flushMode)) { ... } This has critical consequences. Due to this bug, Spring 4.3.0 is not compatible with either Hibernate 5.1.0 nor 5.2.0 When using Hibernate 5.1.0 this bug causes a java.lang.NoSuchMethodError due to the method signature change: java.lang.NoSuchMethodError: org.hibernate.Session.getFlushMode()Ljavax/persistence/FlushModeType; at org.springframework.orm.hibernate5.SpringSessionSynchronization.beforeCommit(SpringSessionSynchronization.java:101) While in Hibernate 5.2.0 this causes javax.persistence.TransactionRequiredException due to equals(FlushMode.MANUAL) always returning false since it is comparing javax.persistence.FlushModeType vs org.hibernate.FlushMode javax.persistence.TransactionRequiredException: no transaction is in progress at org.hibernate.internal.SessionImpl.checkTransactionNeeded(SessionImpl.java:3392) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1385) at org.springframework.orm.hibernate5.SpringSessionSynchronization.beforeCommit(SpringSessionSynchronization.java:104)

    Spring JIRA | 6 months ago | Manuel Dominguez Sarmiento
    javax.persistence.TransactionRequiredException: no transaction is in progress
  3. 0

    Hibernate 5.2.0 changed the method signature for Session.getFlushMode() so that it returns a javax.persistence.FlushModeType instead of a org.hibernate.FlushMode Spring 4.3.0 introduced several changes so that it could remain compatible with both 5.1.0 and 5.2.0 mainly by introducing indirection to obtain the Hibernate flush mode through SessionFactoryUtils.getFlushMode(session). However, this necessary change was omitted from SpringSessionSynchronization which still uses the following code snippet in beforeCommit(): if (!session.getFlushMode().equals(FlushMode.MANUAL)) { ... } which should now be: FlushMode flushMode = SessionFactoryUtils.getFlushMode(session); if (FlushMode.MANUAL.equals(flushMode)) { ... } This has critical consequences. Due to this bug, Spring 4.3.0 is not compatible with either Hibernate 5.1.0 nor 5.2.0 When using Hibernate 5.1.0 this bug causes a java.lang.NoSuchMethodError due to the method signature change: java.lang.NoSuchMethodError: org.hibernate.Session.getFlushMode()Ljavax/persistence/FlushModeType; at org.springframework.orm.hibernate5.SpringSessionSynchronization.beforeCommit(SpringSessionSynchronization.java:101) While in Hibernate 5.2.0 this causes javax.persistence.TransactionRequiredException due to equals(FlushMode.MANUAL) always returning false since it is comparing javax.persistence.FlushModeType vs org.hibernate.FlushMode javax.persistence.TransactionRequiredException: no transaction is in progress at org.hibernate.internal.SessionImpl.checkTransactionNeeded(SessionImpl.java:3392) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1385) at org.springframework.orm.hibernate5.SpringSessionSynchronization.beforeCommit(SpringSessionSynchronization.java:104)

    Spring JIRA | 6 months ago | Manuel Dominguez Sarmiento
    javax.persistence.TransactionRequiredException: no transaction is in progress
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Conception d’un client Eclipse RCP et serveur OSGI avec Spring DM [step16] | Angelo's Blog

    wordpress.com | 4 months ago
    javax.persistence.TransactionRequiredException: no transaction is in progress

    2 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. javax.persistence.TransactionRequiredException

      no transaction is in progress

      at org.hibernate.internal.SessionImpl.checkTransactionNeeded()
    2. Hibernate
      SessionImpl.flush
      1. org.hibernate.internal.SessionImpl.checkTransactionNeeded(SessionImpl.java:3428)
      2. org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1395)
      3. org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1391)
      3 frames
    3. Camel :: JPA
      JpaProducer$1.doInTransaction
      1. org.apache.camel.component.jpa.JpaProducer$1.doInTransaction(JpaProducer.java:85)
      1 frame