Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data Migration using Hibernate

 
Renjith Mohan
Ranch Hand
Posts: 65
Android Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am in the germinal stage of a project development, a project which transfers some of the table data from one database to other. Both databases have the same schema; database server used is MySQL. I am planning to do with hibernate. I understood, to start up the project I need two sessions obtained from separate session factories (each connecting the two databases respectively). The mapping class contains many-to-one associations. So the persistent classes obviously have getter methods of Collection type. How should I approach this project? I saw profuse hibernate forums with hardly blatant solutions on this. So I thought of posting a mail here.

Inviting open discussions

Thank you
Renjith
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any reason you have decided not to use mysqldump and gone for Hibernate instead?
 
Renjith Mohan
Ranch Hand
Posts: 65
Android Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It has to be done programmatically and not manually. That's why I go for hibernate
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Running mysqldump programatically is pretty easy. The reason I mention it is I would always choose the out the box import/export tool before considering writing my own. ORMs are not good choices for bulk data manipulation, its not really what they are designed for.
 
Renjith Mohan
Ranch Hand
Posts: 65
Android Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even if its a data migration, I have some set of conditions to be satisfied prior dumping. Also I want only those data from child tables which satisfies the same condition. I am developing a desktop application on this perspective.

 
Renjith Mohan
Ranch Hand
Posts: 65
Android Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul, you are right. There is no need to go for hibernate.

Finally I managed to finish this project with traditional JDBC.

Thanks Paul
 
Ram kovis
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Renjith Mohan wrote:Paul, you are right. There is no need to go for hibernate.

Finally I managed to finish this project with traditional JDBC.

Thanks Paul


I think, Paul's suggestion is not to bring Java when you are dealing with dataload..

When you have to transfer data between two databases, we better use database tools . Java is not meant for that.
 
Renjith Mohan
Ranch Hand
Posts: 65
Android Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ram, I know Java is not meant for data migration. Here I am not engaged in the bulk data transfer. I have a few tables say, a maximum of 10. I want to copy data from these tables to a secondary database via a java application.

Renjith
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic