-->
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.  [ 3 posts ] 
Author Message
 Post subject: problems with hbm
PostPosted: Fri Dec 23, 2005 4:17 pm 
Newbie

Joined: Fri Dec 23, 2005 3:53 pm
Posts: 2
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.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 23, 2005 4:29 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
<jdbcconfiguration configurationfile="hibernate.cfg.xml">

and hbm2hbmxml just dumps the hbm.xml which the jdbcconfiguration have read from the database.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 27, 2005 11:47 am 
Newbie

Joined: Fri Dec 23, 2005 3:53 pm
Posts: 2
Thanks a lot man, that did the trick.


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