-->
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: SchemaUpdate doesn't delete a table column
PostPosted: Wed Oct 01, 2008 5:11 am 
Newbie

Joined: Sun Jul 27, 2008 10:56 am
Posts: 17
Hibernate version: 3.2.6

Hi all,

I'm trying SchemaUpdate tool via directly calling it by code.

I'm trying with a very simple example, ONLY ONE TABLE, the classic table Person.

So, I've seen that if I add a column, then launching SchemaUpdate, the tool sees new property/column then executes alter table adding new column.

But, if on the contrary I delete that just added property, deleting it either from Person.java either from Person.hbm.xml, the relaunching SchemaUpdate, it seems that it doesn't execute the alter table to delete the column from the table.

Please, can you explain me the reason?

Should SchemaUpdate update every change? Or are there some changes that SchemaUpdate is not able to reproduce?

Thanks in advance, best regards
Gamby


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 01, 2008 9:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
schemaupdate does not know about your previous model thus it cannot know if it should delete that extra column. schemaupdate is additive not destructive ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 01, 2008 9:30 am 
Newbie

Joined: Sun Jul 27, 2008 10:56 am
Posts: 17
Scuse me but this answer doesn't resolve the problem.

There is a real problem, that is, an application in which, version after version, its database is changed, where these changes could be either new columns either some column deletion....
SchemUpdate is unusable

I have to design a mechanism with jdbc and with sql scripts that I deploy with my app and that they are executed on the first execution of the new just installed version performing updating work...

Any other hint?

Thanks in advance,
Gamby


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 02, 2008 4:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
gamby1980 wrote:
Scuse me but this answer doesn't resolve the problem.


Correct, patches resolve problems.

Quote:
There is a real problem, that is, an application in which, version after version, its database is changed, where these changes could be either new columns either some column deletion....


Yes, but schemaupdate was never intended to be used for migrating prod systems automatically.

Quote:
SchemUpdate is unusable


For development it is rather useful.

Quote:
I have to design a mechanism with jdbc and with sql scripts that I deploy with my app and that they are executed on the first execution of the new just installed version performing updating work...


Yes, so create a delta script and execute it.

The solution for this is not schemaupdate but more something like Migrations as known in Rails. I always wanted to do a Hibernate Migrations API but never had the time to do it....any takers ?

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