-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate model upgrade
PostPosted: Mon Dec 31, 2007 1:35 pm 
Regular
Regular

Joined: Wed May 02, 2007 2:42 pm
Posts: 101
Hey,

Now that we are working with ORM and annotation the database left in the background. its greate untill you deliver you first version to the customer and than you need to support in compatibilty to backward.

I want to the get an idea from you how you handle in the model changes?

Does each developer that change the model need also to write the alter?
Do you work with schema comparion tools?

Any idae will be welcome.

Happy new year.


Top
 Profile  
 
 Post subject: Re: Hibernate model upgrade
PostPosted: Wed Jan 02, 2008 8:24 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
avihaimar77 wrote:
I want to the get an idea from you how you handle in the model changes?

Does each developer that change the model need also to write the alter?
Do you work with schema comparion tools?


I agree, hbm2ddl is great for development, but once you are in production you have no or hardly any tools support.

All projects I worked on relied on the fact that - once in production - the developers will create and maintain database migration scripts containing all required db alter commands. In one project we introduced a schema_info table a la Ruby on Rails, but the developers were responsible to update this table as part of the overall migration script. It was far off what 'rake migrate' can do for you.

So far I've only heard of LiquiBase (http://www.liquibase.org/) as a Java based database migration tool. However, I have no idea if and how you could use it in combination with hibernate.

I wonder whether there are any plans within Hibernate to extend hibernate Tools and add more support for database migration?


Top
 Profile  
 
 Post subject: Re: Hibernate model upgrade
PostPosted: Sun Jan 06, 2008 4:53 pm 
Newbie

Joined: Sat Jan 05, 2008 2:19 am
Posts: 3
hardy.ferentschik wrote:
avihaimar77 wrote:
I want to the get an idea from you how you handle in the model changes?

Does each developer that change the model need also to write the alter?
Do you work with schema comparion tools?


I agree, hbm2ddl is great for development, but once you are in production you have no or hardly any tools support.

All projects I worked on relied on the fact that - once in production - the developers will create and maintain database migration scripts containing all required db alter commands. In one project we introduced a schema_info table a la Ruby on Rails, but the developers were responsible to update this table as part of the overall migration script. It was far off what 'rake migrate' can do for you.

So far I've only heard of LiquiBase (http://www.liquibase.org/) as a Java based database migration tool. However, I have no idea if and how you could use it in combination with hibernate.

I wonder whether there are any plans within Hibernate to extend hibernate Tools and add more support for database migration?


I've though a bit about how LiquiBase could be integrated more closely with Hibernate.

What I would like best is a way to describe the database changes along with the database mapping. Unfortunately you run into the problem of where and how you would store your database changes. Normally all changes are appended to a change log file and can be run sequentially, but if you tried to move the change definitions to a hibernate xml file or annotations you would loose control over how they are ordered.

Even if you come up with an ordering scheme you also have the trouble of where you store changes for non-current items. For example: you originally have a mapped "password" column on a "user" table but then drop it. You will no longer have a listing in your hibernate mapping for "password", so where do you put the drop table change?

It seems to me that the best you could do is a "hbm2changelog" app which would compare what the current hibernate mappings to a database and append the changes to the LiquiBase change log file which could then be inspected and then run. LiquiBase already has a database "diff" tool and change log generator so it may be easy to integrate it with the hbm2ddl library, depending on how extensible that tool is.


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