-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Deadlock trying to delete children and parent - JPA2
PostPosted: Wed Jul 14, 2010 6:14 am 
Newbie

Joined: Wed Jul 14, 2010 6:07 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.