-->
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: class="Message" on page 90 not working
PostPosted: Fri Mar 16, 2007 9:30 pm 
Beginner
Beginner

Joined: Mon Feb 27, 2006 11:16 am
Posts: 25
Hi:

I am using MyEclipse 5.1.1 and Microsoft SQL 200.
I tried the example on page 90 Listing 2.17 trying to generate the Message.hbm file.
I was able to generate the Messages.hbm file and the persistence class Messages.java. The problem is that generates a Messages.hbm file not a Message.hbm. The attribute class="Message" should make it generate the Message.hbm instead of Messages.hbm. The table name is Messages.

I used the freemarker.jar and the jtidy-r8-20060801.jar that came from the HibernateTools 3.2.0.beat 9 release(url:http://sourceforge.net/project/showfiles.php?group_id=22866&package_id=72248&release_id=478192). The rest of the jar files I got from the example for CaveatTemptor JPA/EJB 3.0.

Here is my helloworld.reveng.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd">

<hibernate-reverse-engineering>
<table-filter match-name=".*" package="hello"/>
<table name="MESSAGES" schema="PUBLIC" class="Message">
<primary-key>
<generator class="increment"/>
<key-column name="MESSAGE_ID" property="id" type="long"/>
</primary-key>
<column name="MESSAGE_TEXT" property="text"/>
<foreign-key constraint-name="FK_NEXT_MESSAGE">
<many-to-one property="nextMessage"/>
<set exclude="true"/>
</foreign-key>
</table>
</hibernate-reverse-engineering>

Here is my helloworld.db.properties:
hibernate.dialect =org.hibernate.dialect.SQLServerDialect
hibernate.connection.driver_class = net.sourceforge.jtds.jdbc.Driver
hibernate.connection.url = jdbc:jtds:sqlserver://albertlam:1433/Hibernate
hibernate.connection.username = sa
hibernate.connection.password = mychau1

Here is my build.xml:
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="project.classpath"/>

<target name="reveng.hbmxml" description="Produces XML mapping files in src directory">
<hibernatetool destdir="${basedir}/src/java/">
<jdbcconfiguration propertyfile="${basedir}/helloworld.db.properties"
revengfile="${basedir}/helloworld.reveng.xml"/>

<hbm2hbmxml/>
<hbm2cfgxml/>
</hibernatetool>
</target>

<target name="reveng.pojos" description="Produces Java classes from XML mappings">
<hibernatetool destdir="${basedir}/src/java">
<configuration>
<fileset dir="${basedir}/src">
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<hbm2java/>
</hibernatetool>
</target>

Yours,

Curious


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 17, 2007 3:12 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Please ask in the tools forum, if the version you are using is not the same version that shipped with the book example. I did not try any later version with the examples. some things might have changed.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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.