-->
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.  [ 3 posts ] 
Author Message
 Post subject: working with 2 SessionFactory
PostPosted: Sun Aug 28, 2005 5:08 am 
Newbie

Joined: Sat Aug 27, 2005 2:02 pm
Posts: 13
hello everyone,

I'm working with two different SessionFactory at the same time. If i load Objects from the first one, and i try with the other SessionFactory (which aims to another DB) to save them I cannot persist them, due to the fact that hibernate try to modify the identifiers of the formers objects. This doesn't happen if i close the first SessionFactory, before to try to persist the objects.
Is there any way to avoid it?

(hibernate 3.0 - c3p0, working with mysql)
[java] org.hibernate.HibernateException: identifier of an instance of test.Pet altered from 0 to 7

thank you


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 28, 2005 5:16 pm 
Newbie

Joined: Sun Aug 28, 2005 2:13 pm
Posts: 9
I guess you will have to use Session.evict() on the objects, before you use them in another session.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 28, 2005 8:20 pm 
Senior
Senior

Joined: Wed Jul 13, 2005 4:31 pm
Posts: 142
Location: Seattle, WA
INteresting feature I just ran across...might be a much simple way of replicating.

http://www.hibernate.org/hib_docs/v3/reference/en/html/objectstate.html#objectstate-replicating


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.