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.