-->
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: Database versioning/migration toolkit?
PostPosted: Tue Nov 29, 2005 9:41 am 
Beginner
Beginner

Joined: Tue Jun 07, 2005 11:36 pm
Posts: 22
Does anyone know of a useful set of classes to help manage upgrading a particular database schema as you need to push new versions to users? I don't mean the version of the DBMS software, but the actual DB schema that an app accesses.

For example, if v2.0 of MyHibApp adds some columns to one table and changes the type of a column in another, and then v3.0 adds 2 whole new tables, I need a straightforward way to move users from v1.x to v2.0 and then to v3.0. This would involve adding/changing the columns and probably populating existing records with some default values or with values derived from information in the DB already.

I have rolled my own solutions before in C++, but was wondering if anyone had used a good java toolkit that setup a nice structure for you already.

Thanks,

e


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 10:18 am 
Senior
Senior

Joined: Mon Apr 04, 2005 8:04 am
Posts: 128
Location: Manchester, NH USA
In Hibernate 2.x, you can use the generateSchemaUpdateScript method on net.sf.hibernate.tool.hbm2ddl.DatabaseMetadata to determine the deltas (with some degree of accuracy) between your current Hibernate mapping-implied schema and the one your JDBC connection is pointing at. Would this help?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 10:27 am 
Beginner
Beginner

Joined: Tue Jun 07, 2005 11:36 pm
Posts: 22
Not a whole lot since I use Hib 3 and I'd like something that didn't require the mapping files (just to be more general) but it's useful to know it's there, thanks. I have a feeling I'll have to pull in little pieces of useful code from a lot of places and roll my own toolkit.

_________________
Useful? Hit me with a point! Completely off base? Ya, well, what do you expect from a newbie...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 10:53 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the same is available in Hibernate 3 where we also have a SchemaValidator task that does better reporting.

It is more or less impossible to do automatic conversion of data - something is always "special". The best we can do is to provide tools that reports the differences and a script that needs modificaiton to make work.

_________________
Max
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.  [ 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.