I'm getting the following error:
2010-07-14 11:04:45,939 ERROR pool-2-thread-2 ORA-00060: deadlock detected while waiting for resource
2010-07-14 11:04:45,939 WARN pool-2-thread-2 SQL Error: 60, SQLState: 61000 2010-07-14 11:04:45,939 ERROR pool-2-thread-2 ORA-00060: deadlock detected while waiting for resource
2010-07-14 11:04:45,940 ERROR pool-2-thread-2 Could not synchronize database state with session org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:112) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventL istener.java:321) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206) at org.hibernate.impl.SessionImpl.forceFlush(SessionImpl.java:1227) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:1 88) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListene r.java:144) at org.hibernate.ejb.event.EJB3MergeEventListener.saveWithGeneratedId(EJB3MergeEventListener.java :62) at org.hibernate.event.def.DefaultMergeEventListener.mergeTransientEntity(DefaultMergeEventListen er.java:313) at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener. java:282) at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.j ava:396) at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:234) at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:84) at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:859) at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:843) at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:847) at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:682)
I have a parent entity with a one-to-many relationship with a child entity. I'm trying to use the delete_orphan option too. When running multi-threaded, each thread getting a new EntityManager from the EntityManagerFactory, I get the above error. Inside a transaction, My code - queries the parent object and then calls the remove for that object - Creates a new parent object and adds children - commits the transaction. Its works fine single-threaded but I don't understand why it should be different multi-threaded because the parents are all unique.
Any help greatly appreciated.
Gary
|