-->
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.  [ 2 posts ] 
Author Message
 Post subject: operations with two session factories
PostPosted: Wed May 03, 2006 4:03 pm 
Newbie

Joined: Thu Apr 13, 2006 10:52 am
Posts: 3
Hi,

I'm using JBoss, Hibernate and MySql and I have the following problem:

My project has a bean, in a SessionFactory, that needs to remove some POJOs and than needs to run a method in another bean, in another SessionFactory. This second bean removes one POJO, that is present in the POJOs removed by the first bean, because it apears in that POJOs as a many-to-one relatioship. In this case, when I try to remove the POJO from the second bean, the SQL command, ran by hibernate, is deadlocked and returns a timeout error. Than, nothing is removed, because the transactions are rollbacked. I need to know how can I remove these POJOs, without the deadlock problem.

thanks in advance,


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 03, 2006 10:05 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Why do you have two session factories to the same datasource? You should have only one. You can have two sessions though.

If you have locking issues, it's because the first connection hasn't committed its transaction, thus releasing all locks. Ensure that you're doing that. If you're expecting to be able to concurrently delete from a table using one session then insert into that table in another session, then the problem is your expecetion. You'll have to change it.

_________________
Code tags are your friend. Know them and use them.


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

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.