I have a bean object, for example. Entity (EJB 3), which stores child records of the same type in ArrayList<Entity> , its parent <Entity> and relationship to another <Users> object. Users can own many entities and vice versa (many - many).
What I would like to do is to override Entity.clone() (or have a new method) to deep copy Entity along with children clones belonging to the same parent and assigned to existing users.
I created a clone method to create an Entity clone (the new Entity that is), and then populate it with clones of children objects in the foreach loop.
But this gives me the exception of concurrent modification, and I end up only with a clone of the initial Entity bean without its children .
My question is:
This is what I want to do at all, or I need to manage deep copying, for example. Facade? If possible, can you direct me to something to read or give me a couple of tips, because so far I am doing cloning through the facade, and this has become the main load in my application.
Thanks at Advance !!
pataroulis
java orm jpa
pataroulis
source share