aspose file tools*
The moose likes Object Relational Mapping and the fly likes simplest way to achieve this Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "simplest way to achieve this" Watch "simplest way to achieve this" New topic
Author

simplest way to achieve this

Sherif Shehab
Ranch Hand

Joined: Mar 05, 2007
Posts: 483

HI all ,

I'm new to hibernate , i wanna to make a program with java using hibernate to read some data from specific table in db then do some processing on this data then insert it in another Db , what is the simplest design to achieve this ?
PS : this is a console based program ...

Thanks,
Sherif
Javid Jamae
Author
Ranch Hand

Joined: May 14, 2008
Posts: 198
Are the database schemas the same across both DBs? Are the objects/mappings the same across both DBs? If everything is the same, and you're just copying, then you could use two different session factories on top of the same objects/mappings. That being said, you might find it easier to do this sort of copying using database utilities if both databases are the same.

If the schemas are different, then you'll need different objects/mappings. You'll still need two different session factories, one pointing to each set of objects/mapping.


Author: JBoss in Action, javidjamae.com, @javidjamae on Twitter
Sherif Shehab
Ranch Hand

Joined: Mar 05, 2007
Posts: 483

Javid Jamae wrote:Are the database schemas the same across both DBs? Are the objects/mappings the same across both DBs? If everything is the same, and you're just copying, then you could use two different session factories on top of the same objects/mappings. That being said, you might find it easier to do this sort of copying using database utilities if both databases are the same.

If the schemas are different, then you'll need different objects/mappings. You'll still need two different session factories, one pointing to each set of objects/mapping.


ya the db schemas are the same . what Db utilities do you recommend to do this ?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

All databases come with bulk loading tools designed to move data from one schema to another, possibly performing some processing along the way. These tend to be capable of using database features not available to a normal JDBC applciation to speed up performance and also don't require the configuring of a third party product such as Hibernate. Check your database documentation for the topic "bulk loading" or "import/export".


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: simplest way to achieve this