-->
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.  [ 8 posts ] 
Author Message
 Post subject: SchemaUpdate problem
PostPosted: Wed Jun 23, 2004 3:01 pm 
Beginner
Beginner

Joined: Thu Oct 09, 2003 11:41 am
Posts: 39
Location: Paris, France
Hello,

My schemaupdate ant task displays nicely all queries, but the DB remains unchanged...

Here is the task
Code:
    <taskdef name="schemaupdate"
        classname="net.sf.hibernate.tool.hbm2ddl.SchemaUpdateTask">
        <classpath refid="libs"/>
        <classpath path="${classes}"/>
        <classpath path="${basedir}"/>
    </taskdef>

    <target name="schemaupdate"
        depends="compile"
        description="Schema Update to the DB server directly.">

        <schemaupdate
            properties="hibernate.properties"
            quiet="no">
            <fileset dir="${classes}">
                <include name="**/*.hbm.xml"/>
            </fileset>
        </schemaupdate>

    </target>


Any idea why this would happen?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 27, 2004 5:07 pm 
Newbie

Joined: Sun Jun 27, 2004 5:05 pm
Posts: 11
I have only been able to get SchemaExport to work (not SchemaUpdate). Maybe you have to do Export the first time?

(I'm a newbie, so I can't add a lot of advice, sorry).

-Dave


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 27, 2004 5:23 pm 
Beginner
Beginner

Joined: Thu Oct 09, 2003 11:41 am
Posts: 39
Location: Paris, France
It looks like the problem is due to the MySQL driver or server version. Hopefully, some day in the future in one of the future versions it'll work.

For now, I'll simply redirecting the output as follows

ant schemupdate > my_queries.txt

and then copy the queries from there and run them against the DB.

Hope it helps.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 05, 2004 7:10 pm 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
I just began running into this problem as well, I did some debugging to see wtf was actually going on, apparently as of hibernate 2.1.3 or somewhereish around there they changed how the schemaupdate task works (thats when mine broke anyway).. you need to now put a text="no" attribute in the schemaupdate task to get it to execute the update commands to your db, otherwise it just prints them to the screen. example:

Code:
<target name="SchemaUpdateTest">
  <schemaupdate
      properties="${src.dir}/test-resources/hibernate/hibernate-test.properties"
      quiet="no" text="no">
    <fileset dir="${target.classes.java.dir}">
      <include name="**/*.hbm.xml"/>
    </fileset>
  </schemaupdate>
</target>


HTH
-David


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 06, 2004 1:55 am 
Beginner
Beginner

Joined: Thu Oct 09, 2003 11:41 am
Posts: 39
Location: Paris, France
Thanks.

It did not work for me however. It did hide the queries, but the DB was not updated.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 06, 2004 11:13 am 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
Which version of hibernate are you running?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 06, 2004 11:15 am 
Beginner
Beginner

Joined: Thu Oct 09, 2003 11:41 am
Posts: 39
Location: Paris, France
Hibernate 2.1.3


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 06, 2004 11:45 am 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
Here is likely the affending line of code for you in 2.1.3...

Code:
               if (script) System.out.println(sql);
               if(doUpdate) {
                  log.debug(sql);
                  stmt.executeUpdate(sql);
               }


that is from the execute method of SchemaUpdate class. You might want to debug to that point and findout why its not updating. You are running the schemaexport task correct? If so try executing it again with the property text="false", I told you to try text="no" but that may not have been interpreted as a boolean properly.

Try this as your task:

Code:
<target name="schemaupdate"
        depends="compile"
        description="Schema Update to the DB server directly.">

        <schemaupdate
            properties="hibernate.properties"
            quiet="false" text="false">
            <fileset dir="${classes}">
                <include name="**/*.hbm.xml"/>
            </fileset>
        </schemaupdate>

    </target>


You may also consider updating to hib 2.1.4.. I don't know what DB your running but they put in some good fixes for the mysql dialect in 2.1.4 that weren't present in any of the previous builds.
-David


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