-
Dec 27th, 2011, 06:42 AM
#1
"Lock wait timeout exceeded; try restarting transaction" error
Hi.
i am try to do the following:
i have transactionManager ATrxMng that creates entity of type A.
in addition i have transactionManager BTrxMng which creates entity of type B.
Entity B need to be created , in one occasion , with the primary key of A, in a single transaction.
ATrxMng & BTrxMng belong both to different components, and i am trying to call them from a facade layer (higher level).
Now the transaction starts on the facade , and after ATrxMng creates entity of type A, from the facade i send to the BTrxMng the primary key of A, in order to create B.
what actually happens is that i get the below exception from the MySql DB.
i believe that since the two transactions of ATrxMng and BTrxMng aren't the same, i get this excepetion, cause when i try to create B without A's primary key, i succeed.
any hint?
the exception:
javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not insert: [com.amdocs.hub.transactionmnger.domain.Transaction Entity]
at org.hibernate.ejb.AbstractEntityManagerImpl.throwP ersistenceException(AbstractEntityManagerImpl.java :614)
at org.hibernate.ejb.AbstractEntityManagerImpl.persis t(AbstractEntityManagerImpl.java:226)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.orm.jpa.SharedEntityManagerCre ator$SharedEntityManagerInvocationHandler.invoke(S haredEntityManagerCreator.java:198)
at $Proxy35.persist(Unknown Source)
at com.amdocs.hub.transactionmnger.dao.jpa.Transactio nDAOImpl.createTransaction(TransactionDAOImpl.java :45)
at com.amdocs.hub.transactionmnger.action.Subscriptio nRecurringAction.process(SubscriptionRecurringActi on.java:35)
at com.amdocs.hub.transactionmnger.action.Subscriptio nRecurringAction$$FastClassByCGLIB$$dd733e64.invok e(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy. java:149)
at org.springframework.aop.framework.Cglib2AopProxy$C glibMethodInvocation.invokeJoinpoint(Cglib2AopProx y.java:700)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :149)
at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:106)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:106)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
at org.springframework.aop.interceptor.ExposeInvocati onInterceptor.invoke(ExposeInvocationInterceptor.j ava:89)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
at org.springframework.aop.framework.Cglib2AopProxy$D ynamicAdvisedInterceptor.intercept(Cglib2AopProxy. java:635)
at com.amdocs.hub.transactionmnger.action.Subscriptio nRecurringAction$$EnhancerByCGLIB$$ffa1eb09.proces s(<generated>)
at com.amdocs.hub.transactionmnger.services.impl.Tran sactionManagerImpl.execute(TransactionManagerImpl. java:23)
at com.amdocs.hub.pmt.subscriptionrecurring.services. impl.SubscriptionRecurringServiceImpl.updateRenewe dSubscriptions(SubscriptionRecurringServiceImpl.ja va:188)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethod Invocation.invokeJoinpoint(ReflectiveMethodInvocat ion.java:182)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :149)
at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:106)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:106)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:106)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
at org.springframework.aop.framework.adapter.ThrowsAd viceInterceptor.invoke(ThrowsAdviceInterceptor.jav a:126)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
at com.amdocs.hub.pmt.foundation.log.LoggingIntercept or$MethodTimeInvocationHandler.invoke(LoggingInter ceptor.java:201)
at com.amdocs.hub.pmt.foundation.log.LoggingIntercept or.invoke(LoggingInterceptor.java:117)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
at org.springframework.aop.interceptor.ExposeInvocati onInterceptor.invoke(ExposeInvocationInterceptor.j ava:89)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy96.updateRenewedSubscriptions(Unknown Source)
at com.amdocs.hub.pmt.subscriptiorecurring.services.S ubscriptionManagementRecurringServiceTest.updateRe newedSubscriptions(SubscriptionManagementRecurring ServiceTest.java:309)
at com.amdocs.hub.pmt.subscriptiorecurring.services.S ubscriptionManagementRecurringServiceTest.testGetS ubscriptionsPending(SubscriptionManagementRecurrin gServiceTest.java:187)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
.
.
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:197)
Caused by: org.hibernate.exception.GenericJDBCException: could not insert: [com.amdocs.hub.transactionmnger.domain.Transaction Entity]
at org.hibernate.exception.SQLStateConverter.handledN onSpecificException(SQLStateConverter.java:126)
at org.hibernate.exception.SQLStateConverter.convert( SQLStateConverter.java:114)
at org.hibernate.exception.JDBCExceptionHelper.conver t(JDBCExceptionHelper.java:66)
at org.hibernate.id.insert.AbstractReturningDelegate. performInsert(AbstractReturningDelegate.java:64)
at org.hibernate.persister.entity.AbstractEntityPersi ster.insert(AbstractEntityPersister.java:2186)
at org.hibernate.persister.entity.AbstractEntityPersi ster.insert(AbstractEntityPersister.java:2666)
at org.hibernate.action.EntityIdentityInsertAction.ex ecute(EntityIdentityInsertAction.java:71)
at org.hibernate.engine.ActionQueue.execute(ActionQue ue.java:279)
at org.hibernate.event.def.AbstractSaveEventListener. performSaveOrReplicate(AbstractSaveEventListener.j ava:321)
at org.hibernate.event.def.AbstractSaveEventListener. performSave(AbstractSaveEventListener.java:204)
at org.hibernate.event.def.AbstractSaveEventListener. saveWithGeneratedId(AbstractSaveEventListener.java :130)
at org.hibernate.ejb.event.EJB3PersistEventListener.s aveWithGeneratedId(EJB3PersistEventListener.java:4 9)
at org.hibernate.event.def.DefaultPersistEventListene r.entityIsTransient(DefaultPersistEventListener.ja va:154)
at org.hibernate.event.def.DefaultPersistEventListene r.onPersist(DefaultPersistEventListener.java:110)
at org.hibernate.event.def.DefaultPersistEventListene r.onPersist(DefaultPersistEventListener.java:61)
at org.hibernate.impl.SessionImpl.firePersist(Session Impl.java:645)
at org.hibernate.impl.SessionImpl.persist(SessionImpl .java:619)
at org.hibernate.impl.SessionImpl.persist(SessionImpl .java:623)
at org.hibernate.ejb.AbstractEntityManagerImpl.persis t(AbstractEntityManagerImpl.java:220)
... 65 more
Caused by: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
at com.mysql.jdbc.SQLError.createSQLException(SQLErro r.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLErro r.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:3558)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules