-->
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: Cascade copy
PostPosted: Thu Feb 05, 2009 5:11 pm 
Newbie

Joined: Thu Feb 05, 2009 4:17 pm
Posts: 8
Hibernate version 3, integrating with Spring & Spring MVC.

I'm familiar with cascade delete, and I'm wondering if there's anyway that I could perform cascade copy.

An example would be parent-child relationship.
If I create a copy of the parent, would I be able to create a copy of each children that the parent has (and also the children's of each child).

If this is possible, could someone point me to the right direction?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 06, 2009 12:41 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
I think ur solution would be cloning with deep copy.
http://www.java2s.com/Code/Java/Language-Basics/DeepCopyTest.htm


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 20, 2009 2:01 pm 
Newbie

Joined: Thu Feb 05, 2009 4:17 pm
Posts: 8
Is the deep copy you were refering to, requiring the models to implement clonable?

Would org.hibernate.session.replicate() works?
The description of this method says:
Persist the state of the given detached instance, reusing the current identifier value. This operation cascades to associated instances if the association is mapped with cascade="replicate".

I've read from other people's posting to use Hibernate3BeanReplicator, and I've made it work with this. Is this the best practice?


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.