I'm focusing on a task for an organization, where I have to migrate its previous data right into a new system. Clearly both structures are completely different and I am using hibernate for database manipulation and confused in regards to what will be the ultimate way emigrate data. Must I use hibernate, must i write saved methods, or perhaps is there an alternative choice? Any vibrant ideas are welcome.

Getting attempted both approaches previously, I'm able to certainly state that this isn't a predicament that ORM was created, nor one where it flourishes. You finish up needing to build two different teams of objects, and it is hard to gain the efficiency needed for any mass migration. The only real reason I'm able to think about for implementing something similar to hibernate could be should you be creating a system which would permanently sit among two systems to integrate them, however it seems like this really is relatively short-term.

I've been very pleased with the outcomes of the python script, a lot of SQL plus some python objects to change the information.

Hibernate doesn't play perfectly with saved methods - it is not a 'natural fit'. In case your ORM has already been planned out , and you've got your 'as-is' and 'to-be' objects setup, use normal hibernate techniques to create data for your new layout.

If you're instructed to go the StoredProcedure way, you'll be able to decide if you wish to swallow the discomfort, and code your transforms within the saved methods - this way all of your migration scripts will remain together.

Such as the other poster stated, a scripting language like Python can be beneficial here - it's labored well for me personally too.

I have attempted to handle data migration when i change my code and my data representation through various releases. Every time, I have wound up writing specific sql to question for objects within the old condition, and also to populate new posts. If there is a straightforward method to manage data migration while viewing everything being an object, I've not considered it, and to date, the brand new posts have also have simple understanding which i could calculate in sql.

A number of them happen to be not so difficult the code has wound up in java, along with other changes happen to be complex enough which i wanted multiple sql claims, therefore i wound up embedding them in spend and python (both, for portability) scripts. The scripts are here and [the java code][2] with method names like updateDB2008_4().

[2]: file: http://zocalo.svn.sourceforge.net/viewvc/zocalo/trunk/devel/src/net/commerce/zocalo/hibernate/HibernateUtil.java

While I don't know about "best", I would rather use Hibernate or perhaps a similar ORM basically is at your situation. This is because then you've an item hierarchy to make use of between your two databases. When the schemas are very similar, a simply SQL script may be simpler. It truly is dependent on which you are, and also the more knowledge about it.

edit: I truly take some morning caffeine...

Things I was trying to notice, was noted through the a couple who published after me. When the schemas are defined, you have objects or are great using the reverse engineering tools, then hibernate is a straightforward approach to take. However, if it's a 1 time factor, scripts are certainly the greater approach to take.

utilization of hibernate appears simple as i've database planned with hibernate.. however when object collection becomes large then heap/memory issues come...as well as utilization of hibernate would be to save an entire hirarchy of objects.. so wat to complete to solve heap issues

Personally I'd most likely use am ETL tool like SSIS (if you are planning from in order to SQL Server) with this, movement of huge levels of information is what ETl tools are made and enhanced to complete.