-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to use same Hib objs on two DBs
PostPosted: Wed Sep 14, 2005 11:20 am 
Newbie

Joined: Wed Sep 14, 2005 11:17 am
Posts: 3
I have to copy data from a set of tables on one DB to a set of identical tables on another. I already have hibernate objects for these tables, and wish to reuse them. Is there an easy way to pull the data from the source into the objects and them save them to the destination?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 5:07 pm 
Newbie

Joined: Wed Sep 14, 2005 11:03 am
Posts: 4
Location: Mississauga
Try this.

Create session for DB1 (source)
Create session for DB2 (destination)
Query session of DB1 for objects (preferable some kind of root object)
Call save of session of DB2

Just keep the memory usage in mind. This might load the entire DB in memory before saving in the other. Might wanna do it an object at a time.

_________________
_________________________________
Haider Kazmi

|-|-|-|-|-|-|-|-|-|-|-|
Don't Forget to rate!
|-|-|-|-|-|-|-|-|-|-|-|


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