jQuery in Action, 2nd edition
The moose likes Java in General and the fly likes clone collection and save the realtion between the entries in the collection Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "clone collection and save the realtion between the entries in the collection" Watch "clone collection and save the realtion between the entries in the collection" New topic
Author

clone collection and save the realtion between the entries in the collection

avihai marchiano
Ranch Hand

Joined: Jan 10, 2007
Posts: 342
Hey,

I suspect that there is no generic solution for this question , but i will try.

I have a collection (A) of entities (ejb3 ) "Foo" i need to clone this collection and to clean the data base id from the entities .

After clone i have a clone collection (B)

The issue is that i need to save in the DB the new clone collection and after i save i need know which entity in B is clone of which entity in A.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

You can only do this if you have another unique property (or combination of properties) of the beans, such as the name. After all, there has to be a way to tell that two objects are still equal even though the ID has changed.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
avihai marchiano
Ranch Hand

Joined: Jan 10, 2007
Posts: 342
Yep, that what i thought. i try to see if someone else will find a creative idea , but i guess there isnt.

Thank you
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: clone collection and save the realtion between the entries in the collection
 
Similar Threads
"Logical join" in hibernate
Same entity - Two different tables
JPA Delete Entity and Refresh Collections containing Entity
Complete Example Reproducing "Found shared references to a collection"?
Issue when using 2 entity managers to manage one entity from one database to another