Migrated from hibernate 3 to hibernate 5.4

2025-06-30 16:56:55,902 ERROR [com.eurostar.app.edcs.dataaccess.common.CommonDAImpl] (default task-1) Exception occured while executing addAppLog method : javax.persistence.TransactionRequiredException: no transaction is in progress

This is the error i get after migrating hibernate from version 3 to 5.4 ?
Any resolution would be great help.
Thanks in advance

There is simply not enough information in your post to help you. Post more details like e.g. a stack trace.

You can look through the various migration guides that we write for every release and then you will hopefully find this:

  • 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.

which was changed as part of HHH-10877

1 Like

Exception occured while executing addAppLog method : javax.persistence.TransactionRequiredException: no transaction is in progress
at deployment.coreedcs.ear.coreedcs.war//org.hibernate.internal.AbstractSharedSessionContract.checkTransactionNeededForUpdateOperation(AbstractSharedSessionContract.java:422)
at deployment.coreedcs.ear.coreedcs.war//org.hibernate.internal.SessionImpl.checkTransactionNeededForUpdateOperation(SessionImpl.java:3397)
at deployment.coreedcs.ear.coreedcs.war//org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1354)
at deployment.coreedcs.ear.coreedcs.war//org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1349)
at deployment.coreedcs.ear.coreedcs.war//com.eurostar.app.edcs.dataaccess.dao.impl.EDCSDaoImpl.saveOrUpdateObject(EDCSDaoImpl.java:1469)
at deployment.coreedcs.ear.coreedcs.war//com.eurostar.app.edcs.dataaccess.dao.impl.EDCSDaoImpl$$FastClassBySpringCGLIB$$f0a9f321.invoke()
at deployment.coreedcs.ear.coreedcs.war//org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:792)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:762)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:762)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:707)
at deployment.coreedcs.ear.coreedcs.war//com.eurostar.app.edcs.dataaccess.dao.impl.EDCSDaoImpl$$EnhancerBySpringCGLIB$$dc802fdb.saveOrUpdateObject()
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at deployment.coreedcs.ear.coreedcs.war//org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:241)
at deployment.coreedcs.ear.coreedcs.war/jdk.proxy63/jdk.proxy63.$Proxy1144.saveOrUpdateObject(Unknown Source)
at deployment.coreedcs.ear.coreedcs.war//com.eurostar.app.edcs.dataaccess.common.CommonDAImpl.addAppLog(CommonDAImpl.java:82)
at deployment.coreedcs.ear.coreedcs.war//com.eurostar.app.edcs.service.common.CommonManagerImpl.appLog(CommonManagerImpl.java:221)
at deployment.coreedcs.ear.coreedcs.war//com.eurostar.app.edcs.service.common.CommonManagerImpl.log(CommonManagerImpl.java:173)
at deployment.coreedcs.ear.coreedcs.war//com.eurostar.app.edcs.service.common.CommonManagerImpl.saveAppLog(CommonManagerImpl.java:151)
at deployment.coreedcs.ear.coreedcs.war//com.eurostar.app.edcs.service.common.CommonManagerImpl.processApplicationLog(CommonManagerImpl.java:143)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569) i hope this includes the stack trace i am still not able to reslove this issue…

Did you set this configuration property? hibernate.allow_update_outside_transaction=true

Thanks for the support.Yes,i added but still i am getting below error…i am trying to schedule events which loads data in local DB 13:54:13,669 INFO [com.eurostar.app.edcs.service.dailyeventschedule.DailyEventScheduleManagerImpl] (default task-1) invoked addDailyEventForCore..
13:54:13,678 INFO [com.eurostar.app.edcs.dataaccess.dao.impl.EDCSDaoImpl] (default task-1) Is transaction active? true
13:54:13,678 INFO [com.eurostar.app.edcs.dataaccess.dao.impl.EDCSDaoImpl] (default task-1) EntityManager isOpen? true
13:54:13,687 ERROR [com.eurostar.app.edcs.dataaccess.common.CommonDAImpl] (default task-1) Exception occured while executing addAppLog method : javax.persistence.TransactionRequiredException: No EntityManager with actual transaction available for current thread - cannot reliably process ‘merge’ call
at deployment.scheduler.ear//org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:300)
at deployment.scheduler.ear.scheduler.war/jdk.proxy33/jdk.proxy33.$Proxy272.merge(Unknown Source)
at deployment.scheduler.ear//com.eurostar.app.edcs.dataaccess.dao.impl.EDCSDaoImpl.saveOrUpdateObject(EDCSDaoImpl.java:1418)
at jdk.internal.reflect.GeneratedMethodAccessor487.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at deployment.scheduler.ear//org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at deployment.scheduler.ear//org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at deployment.scheduler.ear//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at deployment.scheduler.ear//org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
at deployment.scheduler.ear//org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
at deployment.scheduler.ear//org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
at deployment.scheduler.ear//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at deployment.scheduler.ear//org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:241)
at deployment.scheduler.ear.scheduler.war/jdk.proxy33/jdk.proxy33.$Proxy274.saveOrUpdateObject(Unknown Source)
at deployment.scheduler.ear//com.eurostar.app.edcs.dataaccess.common.CommonDAImpl.addAppLog(CommonDAImpl.java:82)
at deployment.scheduler.ear//com.eurostar.app.edcs.service.common.CommonManagerImpl.appLog(CommonManagerImpl.java:225)
at deployment.scheduler.ear//com.eurostar.app.edcs.service.common.CommonManagerImpl.log(CommonManagerImpl.java:176)
at deployment.scheduler.ear//com.eurostar.app.edcs.service.common.CommonManagerImpl.saveAppLog(CommonManagerImpl.java:154)
at deployment.scheduler.ear//com.eurostar.app.edcs.service.common.CommonManagerImpl.processApplicationLog(CommonManagerImpl.java:146)
at jdk.internal.reflect.GeneratedMethodAccessor481.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at deployment.scheduler.ear//org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at deployment.scheduler.ear//org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at deployment.scheduler.ear//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at deployment.scheduler.ear//org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
at deployment.scheduler.ear//org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
at deployment.scheduler.ear//org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
at deployment.scheduler.ear//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at deployment.scheduler.ear//org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:241)
at deployment.scheduler.ear.scheduler.war/jdk.proxy33/jdk.proxy33.$Proxy279.processApplicationLog(Unknown Source)
at deployment.scheduler.ear//com.eurostar.app.edcs.common.logger.EDCSLogger.setAppSysLogsModels(EDCSLogger.java:26)
at deployment.scheduler.ear//com.eurostar.app.edcs.common.logger.EDCSLogger.setAppSysLogModels(EDCSLogger.java:134)
at deployment.scheduler.ear.scheduler.jar//com.eurostar.app.edcs.service.dailyeventschedule.DailyEventScheduleManagerImpl.addDailyEventForCore(DailyEventScheduleManagerImpl.java:2159)
at deployment.scheduler.ear.scheduler.jar//com.eurostar.app.edcs.service.dailyeventschedule.DailyEventScheduleManagerImpl.processFunction(DailyEventScheduleManagerImpl.java:238)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) What could be reason for scheduler events not running after hibernate Migration? i am using EntityManager instead of HibernateTemplate since it is deprecated in hibernate 5+

I can’t really help you there. You’re using Spring within A Java EE container and I have no idea how your EntityManager/Session is configured and wired up. I guess you didn’t just migrate Hibernate but also Spring to a newer version, so the problem is most likely in that configuration. Form the stack trace it looks like a transaction should be active, but for some reason, Hibernate ORM does not see that transaction. Maybe Spring configures Hibernate to use a Spring transaction manager but in reality, JTA transactions are used?

yes ,the project is using jta transactions since ejb is used for communication i am using spring(5.3.39)and hibernate(5.4.32.Final) to support legacy code that used HibernateTemplate and migrate to latest versions by replacing HibernateTemplate with EntityManager.Your guidance would be appreciated.Thanks in advance

Sorry, but it seems you have some sort of Spring integration issue then. I can’t help you with that. Ask in Spring forums instead.