| Author |
SchemaUpdateTask executes create query
|
Ganesan Kaliyaperumal
Greenhorn
Joined: Jul 31, 2006
Posts: 5
|
|
Hi, I am using the following ant target to synchronize and update the DB. <target name="schema_update" depends="persistence_config" description="Update missing columns DB schema from the O/R mapping files"> <taskdef name="schemaupdate" classname="net.sf.hibernate.tool.hbm2ddl.SchemaUpdateTask" classpathref="project.class.path" /> <schemaupdate properties="${release.dir}/${config.dir}/hibernate.properties" quiet="no" text="no" > <fileset dir="${config.hbm.dir}"> <include name="**/*.hbm.xml"/> </fileset> </schemaupdate> </target> While running this target the ant conosle shows statements as follow, "create table user_role (fk_role bigint not null, fk_user bigint not null, primary key (fk_user, fk_role))"... I wonder why the create queries are being executed while running this target, instead only the update queries have to be executed. (Note: the *.hbm.xml file has some newly inserted column, but this column was not being inserted into the corresponding table). Atlast I get the message of "Build Successfull". Can you help me to resolve this issue. Regards Ganesan
|
 |
saranga rao
Ranch Hand
Joined: Apr 24, 2007
Posts: 49
|
|
hi, if You generate the DDL of then You could have found the sql statments will be drop database with teh create tables .........with the insert and finally it si updata regards saranga
|
 |
Ganesan Kaliyaperumal
Greenhorn
Joined: Jul 31, 2006
Posts: 5
|
|
Hi Saranga Thanks for your reply. Does the SchemaUpdateTask rely on DB driver? I ran the same target in two different servers, in the first server, I can only able to see the alter table... queries are being excecuted, where as in other server I get the create table ... and alter table... queries executed. And more importantly in the second case the newly inserted column was not updated in the DB. Regards Ganesan
|
 |
saranga rao
Ranch Hand
Joined: Apr 24, 2007
Posts: 49
|
|
Yes It depends on the DB driver where you have specified in hibernate properties file
|
 |
 |
|
|
subject: SchemaUpdateTask executes create query
|
|
|