-->
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: How to update (alter) existing columns in a table
PostPosted: Wed Nov 09, 2005 11:33 am 
Newbie

Joined: Thu Sep 22, 2005 2:53 am
Posts: 4
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Hi!
I have a table JOB, and I modified the definition of the column X from integer
to long. The HBM2DDL is set to UPDATE; I'm using MySQL; when I start JBoss the table is not updated.
I saw in the source code (in the Table class) that the "alter table" statement is created only for columns that don't already exist in the table.
So, is it possible in some way to update the type of an existing column in the table???
Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 09, 2005 12:55 pm 
Beginner
Beginner

Joined: Tue Jul 12, 2005 1:50 pm
Posts: 26
Why you dont grab the mapping for that particular table and synchronize it again?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 10, 2005 4:12 am 
Newbie

Joined: Thu Sep 22, 2005 2:53 am
Posts: 4
I want to do this very simple; the MySQL statement would be "alter table JOB change X X longint"...can Hibernate do this?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 10, 2005 4:35 am 
Newbie

Joined: Thu Sep 22, 2005 2:53 am
Posts: 4
The scenario is as follows:
I have lot of data in the JOB table, where the X column has the type "int".
Due to the new requirements, in the Hibernate mapping file I have to update the column type to "long".
The HBM2DDL is set to UPDATE.
I redeployed the application, but when I started JBoss the column X was not altered to "long".
Any ideas?


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.