-->
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.  [ 4 posts ] 
Author Message
 Post subject: Copy objects as templates
PostPosted: Thu Mar 11, 2004 7:44 pm 
Newbie

Joined: Tue Dec 30, 2003 11:12 pm
Posts: 3
I would like to copy objects as templates for an administrative function in my application. I am using Hibernate 2.1 with MySQL and Struts. I can not find out how to do this in the documentation.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 12, 2004 2:31 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I don't uderstand you needs

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 12, 2004 7:17 pm 
Newbie

Joined: Tue Dec 30, 2003 11:12 pm
Posts: 3
I have a typical object graph reprensenting the model. There are a lot of fields associated and relationships in this graph. I would like to know if there is an API in Hibernate that takes one object and copies all the fields and relationships into a new object.

Something like:


Foo bar = (Foo)session.load(Foo.class, new Long(5));

Foo foo = (Foo)session.copy(bar);

session.save(foo);


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 12, 2004 8:30 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Use the Hibernate ClassMetadata to write your own deep/shallow copy algorithem, for your own specific needs.


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