-->
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: Instances in memory and in DB
PostPosted: Wed Nov 14, 2007 8:27 am 
Newbie

Joined: Sun Apr 29, 2007 4:27 am
Posts: 10
Location: Israel
Hey,
Although it looks like a real simple question, I want to ensure I’ve chosen the best solution.

I’ve two Classes A and B and which has reference to the same(!) instance of class C.
The cascade type of C in both A and B, includes cascade.persist.
In my test, I’ve created instance of A and an instance of B, as commented before-
Both instances reference the same instance of C.
I’ve saved A and B’s instances, and of course although A and B were referencing the same C,
The C instance got two different orm-id (one in A’s hierarchy, and on in B’s).

My solution was to persist C first and then set A’s C and B’s C to be my instance.
Any better idea?


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.