-->
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.  [ 2 posts ] 
Author Message
 Post subject: Does ExportSchemaTask + hibernate.cfg.xml work ok?
PostPosted: Sun Mar 27, 2005 8:18 pm 
Newbie

Joined: Sun Mar 20, 2005 10:40 am
Posts: 11
Location: London (UK)
So I'm using Hibernate 3.0 RC1.

SchemaExport is working fine as a command line task, and I can get it running as an Ant task if I specify the appropriate details as a hibernate.properties file. But I can't get the thing to work using a hibernate.cfg.xml file.

The error message is

Quote:
Schema text failed: The dialect was not set. Set the property hibernate.dialect.


Here's the task in my build.xml

Code:
<target name="schema">
   <taskdef name="schemaexport"
       classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
       classpathref="classpath.base"/>
 
   <schemaexport
       config="hibernate.cfg.xml"
       quiet="no"
       text="yes"
       drop="no"
       output="export.sql">
   </schemaexport>
</target>


I "know" it's at least reading my hibernate.cfg.xml file because if I substitute "leopard.cfg.xml" it complains most vociferously about the missing file...

However, I've tried rather crudely instrumenting the Environment.getProperties method and it doesn't seem to have been populated with any of the property fields in the Hibernate.cfg.xml file.

Here it is:
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration
   PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
   "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
   <session-factory>
      <property name="connection.driver_class">
         org.hsqldb.jdbcDriver
      </property>
      <property name="connection.url">
         jdbc:hsqldb:hsql://localhost/hibernate
      </property>
      <property name="connection.username">sa</property>
      <property name="connection.password"></property>
      <property name="pool_size">5</property>
      <property name="dialect">org.hibernate.dialect.HSQLDialect</property>     
      <property name="show_sql">false</property>     

      <mapping resource="foo\bar\Advert.hbm.xml"/>
      <mapping resource="foo\bar\Category.hbm.xml"/>
      <mapping resource="foo\bar\Phone.hbm.xml"/>
      <mapping resource="foo\bar\User.hbm.xml"/>
</session-factory>

</hibernate-configuration>

But I'm fairly sure that's actually correct, because some simple Hibernate applications actually run just fine (after the schema's established by some other means), and they must at the bare minimum be getting the connection details (musn't they?) - it looks a lot like the property fields are just being ignored...?

So is it actually supposed to be possible to set up an Ant task like this? Or is it a bug? Or am I just doing something stupid (I suspect the latter...)

Dave.


Top
 Profile  
 
 Post subject: Seems to be the same problem as this one:
PostPosted: Tue Mar 29, 2005 5:18 am 
Newbie

Joined: Sun Mar 20, 2005 10:40 am
Posts: 11
Location: London (UK)
http://forum.hibernate.org/viewtopic.php?t=939971


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