-->
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: hbm2dll: no schema export to hsql database
PostPosted: Thu Jul 27, 2006 5:12 am 
Newbie

Joined: Thu Jul 27, 2006 3:44 am
Posts: 4
hsql: 1.8.0.4
hibernate: 3.1.3
hibernate-tools: 3.2.0beta6a

Hi to all,
I've got an ant task to export my database schema directly to the database:
Code:
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="hibernatetoolpath" />
<target name="db.schematodatabase"
   <hibernatetool destdir="${dir.database.dll}">
      <configuration propertyfile="${dir.configuration}/hibernate.properties">
         <fileset dir="${dir.src}">
            <include name="*.hbm.xml"/>
         </fileset>
      </configuration>
      <hbm2ddl export="true" drop="true" />
   </hibernatetool>
</target>


If I'm using hsql, the schema won't export to the database, the log doesn't show any error messages. But if I'm using postgres, it works as expected!

Is it me, or is it a bug ?

Any hints are welcome!
Cheers,
Thilo


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 27, 2006 5:31 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
did you put a log4j.properties/xml into the claspath to actually se the logging ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 27, 2006 7:20 am 
Newbie

Joined: Thu Jul 27, 2006 3:44 am
Posts: 4
Max, thank you for your quick replay?

yep, I've got the full log. The strange thing is, if the hsqldb is empty, I get the nomral info log statements about table creation etc. But nothing is happend to my database. But if my database has the required schema (I've imported it by hand), I got correct error statements like :
Code:
[hibernatetool] Error #1: java.sql.SQLException: Table already exists: SITE in statement [create table SITE]
[hibernatetool] java.sql.SQLException: Table already exists: SITE in statement [create table SITE]
[hibernatetool]         at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
[hibernatetool]         at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
[hibernatetool]         at org.hsqldb.jdbc.jdbcStatement.executeUpdate(Unknown Source)
[hibernatetool]         at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:306)
[hibernatetool]         at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:265)
[hibernatetool]         at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:188)
[hibernatetool]         at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:57)
[hibernatetool]         at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:160)
[hibernatetool]         at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[hibernatetool]         at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatetool]         at org.apache.tools.ant.Target.execute(Target.java:341)
[hibernatetool]         at org.apache.tools.ant.Target.performTasks(Target.java:369)
[hibernatetool]         at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[hibernatetool]         at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
[hibernatetool]         at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
[hibernatetool]         at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[hibernatetool]         at org.apache.tools.ant.Main.runBuild(Main.java:668)
[hibernatetool]         at org.apache.tools.ant.Main.startAnt(Main.java:187)
[hibernatetool]         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
[hibernatetool]         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)


I'm confused about, if the database is empty, I get the normal messages about table creation and so on, but really nothing is happend!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 27, 2006 7:38 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
my guess is that the sql is correctly executed but that hsqldb in your configuration does not peform a shutdown correctly to leave the tables there.

this is a quirk of HSQLDB and look in its documentation for ways to solve it.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 27, 2006 12:05 pm 
Newbie

Joined: Thu Jul 27, 2006 3:44 am
Posts: 4
max, it seems you are right. but it is a tricky bit to solve this!

should I post my solution, if I would find one?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 27, 2006 2:17 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
sure - and i bet it has to do with enabling shutdown true ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 28, 2006 3:35 am 
Newbie

Joined: Thu Jul 27, 2006 3:44 am
Posts: 4
Max, you are great!

I've just added hibernate.connection.shutdown=true and it runs as expected! I thought I've read the whole hibernate manual, but the shutdown property was new for me.

Thank you very much for your help!
Thilo


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 28, 2006 3:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
its not a hibernate property, but a property for the hsqldb connection.

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