-->
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: Is CodeGenerator missing or have I lost my mind?
PostPosted: Fri Oct 15, 2004 3:42 pm 
Beginner
Beginner

Joined: Fri Oct 15, 2004 2:54 pm
Posts: 33
Location: Austin, TX
Hibernate version:
2.1.6
Mapping documents:
trivial (team-player example)
Code between sessionFactory.openSession() and session.close():
I can't get that far yet.
Full stack trace of any exception that occurs:
java.lang.NoClassDefFoundError: net/sf/hibernate/tool/hbm2java/CodeGenerator
Name and version of the database you are using:
MySQL 4.0.21-nt
The generated SQL (show_sql=true):
I can't get that far yet.
Debug level Hibernate log excerpt:
I can't get that far yet.


Good header, bTW. I am building a java project (in Eclipse 3) that uses mySQL for the back end. This is simple -- not even an enterprise app. The JDBC connections work fine, but before I get too far into the project I wanna make sure I have all the utils up and running that I would need.

Enter Hibernate. Looks like a great tool. I can't get it to work.

I made 2 mapping files. Here they are:
Code:
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
  <class name="example.Team" table="teams">
    <id name="id" column="team_id" type="long" unsaved-value="null">
      <generator class="hilo"/>
    </id>
    <property name="name" column="team_name" type="string"
        length="15" not-null="true"/>
    <property name="city" column="city" type="string" length="15" not-null="true"/>
    <set name="players" cascade="all" inverse="true" lazy="true">
      <key column="team_id"/>
      <one-to-many class="example.Player"/>
    </set>
  </class>
</hibernate-mapping>

<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
  <class name="example.Player" table="players">
    <id name="id" column="player_id" type="long" unsaved-value="null">   
      <generator class="hilo"/>
    </id>
    <property name="firstName" column="first_name" type="string" length="12" not-null="true"/>
    <property name="lastName" column="last_name" type="string" length="15" not-null="true"/>
    <property name="draftDate" column="draft_date" type="date"/>
    <property name="annualSalary" column="salary" type="float"/>
    <property name="jerseyNumber" column="jersey_number" type="integer" length="2" not-null="true"/>
    <many-to-one name="team" class="example.Team" column="team_id"/>
  </class>
</hibernate-mapping>
</text>

Then I started to run schemaexport. The error messages I got made me realize I needed the java stubs to be generated first, so I tried to run the code generator. I made a batch file similar to the supplied schemaexport.bat and got the NoClassDefFoundError mentioned above. So, I started looking in the binary distribution I had downloaded (hibernate-2.1.6.zip -- 17,497,476 bytes) trying to find the CodeGenerator class. It's nowhere to be found. Some other forum I googled up had a message about an ext package. I don't see anything like that here. I also looked in all the jar files that came with the distribution to see if I could find any hint of it there, or in the src tree. Nope. Where is it?

_________________
--Pierce Krouse


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 15, 2004 3:46 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
http://www.hibernate.org/102.html

_________________
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.