Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hi guys. I'm using Hibernate 3.1rc3, Hibernate Tools 3.1.0 beta2, and trying to generate .hbm.xml and .java files from the database of a MySql 5.1 (using mysql-connector-3.1.11)
My questions are two:
1. My hibernate.cfg.xml file is in the same place as the hibernate.properties file I created, yet when I attempt to run the ant task without the hibernate.properties file present, I get the following exception:
/usr/local/ild-mysql-test/web/ild/build.xml:11:
org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
at org.apache.tools.ant.Task.perform(Task.java:373)
<...snip ...>
However, when I put in the hibernate.properties file (and get rid of the hibernate.cfg.xml file) and attempt to run the ant task, I get this:
/usr/local/ild-mysql-test/web/ild/build.xml:11: org.hibernate.exception.JDBCConnectionException: Getting database metadata
at org.apache.tools.ant.Task.perform(Task.java:373)
<...snip...>
My build.xml file looks like this:
<project>
<target name="makeClasses">
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask">
<classpath>
<fileset dir="../common/lib/ant_tools"/>
<fileset dir="../common/lib/ant_tools/tools"/>
<fileset dir="../common/lib/"/>
<pathelement location="./WEB-INF/classes"/>
</classpath>
</taskdef>
<hibernatetool destdir="./WEB-INF/classes">
<jdbcconfiguration/>
<hbm2hbmxml/>
</hibernatetool>
</target>
</project>
And my hibernate.properties file looks like this:
connection.driver_class = com.mysql.jdbc.Driver
hibernate.connection.url = jdbc:mysql://localhost:3306/ild
hibernate.connection.username = ****
hibernate.connection.password = ****
hibernate.dialect = org.hibernate.dialect.MySQLDialect
So, the actual questions:
How can I get hibernate-tools to see the hibernate.cfg.xml file?
What's with the "Getting database metadata" exception?
From what I understood after poring over the documentation, <hbm2hbmxml/> is supposed to generate a set of .hbm.xml files from database metadata. Perhaps I misunderstood this and am using the wrong tools?
Thanks for any feedback.