-->
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: Generating Hibernate Schema
PostPosted: Mon Aug 22, 2005 10:24 pm 
Newbie

Joined: Mon Aug 22, 2005 10:09 pm
Posts: 2
I'm trying to take an annotated object and turn it into a db schema. The object I'm testing this out on is a simple object with only an interger(id), and two strings. The only annotation is the @Entity(from javax.persistence). I'm using the latest hibernate-tools (alpha5) with the following code from maven.xml:
Code:
      <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpath="maven.dependency.classpath">
         <classpath>
            <pathelement location="lib/hibernate-tools-3.0.0.alpha5.jar" />
            <path refid="maven.dependency.classpath"/>
         </classpath>
      </taskdef>
       <hibernatetool destdir="target/hibernate">
         <classpath>
             <path location="target/classes"/>
             <pathelement location="lib/ejb-3.0.jar" />
         </classpath>
         
         <annotationconfiguration configurationfile="src/webapp/WEB-INF/hibernate.cfg.xml"/>

         <hbm2ddl drop="false"/>
       </hibernatetool>


The hibernate.cfg.xml is the following:
Code:
<hibernate-configuration>
   <session-factory name="hibernateSession">
      <property name="hibernate.connection.driver_class">
         org.postgresql.Driver
      </property>
      <property name="hibernate.connection.url">
         jdbc:postgresql:template1
      </property>
      <property name="hibernate.connection.username">root</property>
      <property name="hibernate.dialect">
         org.hibernate.dialect.PostgreSQLDialect
      </property>
        <mapping class="model.Province" />
   </session-factory>
</hibernate-configuration>


With the above, and running the task for maven.xml I get the following error:
Code:
    [hibernatetool] Executing Hibernate Tool with a Hibernate Annotation/EJB3 Configuration
    [hibernatetool] 1. task: hbm2ddl (Generates database schema)

BUILD FAILED
File...... /.../maven.xml
Element... hibernatetool
Line...... 14
Column.... 46
org.hibernate.cfg.Mappings.<init>(Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/List;Ljava/util/List;Lorg/hibernate/cfg/NamingStrategy;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;)V


More info below. If I should post more info, let me know.

Thanks,

Chris

Hibernate version: 3.1alpha1

Mapping documents: Using annotations, just a simple @Entity for an object without any relations, etc.

Full stack trace of any exception that occurs:

Code:
    [hibernatetool] Executing Hibernate Tool with a Hibernate Annotation/EJB3 Configuration
    [hibernatetool] 1. task: hbm2ddl (Generates database schema)

BUILD FAILED
File...... /.../maven.xml
Element... hibernatetool
Line...... 14
Column.... 46
org.hibernate.cfg.Mappings.<init>(Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/List;Ljava/util/List;Lorg/hibernate/cfg/NamingStrategy;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;)V


Name and version of the database you are using: Postgresql 7.4.8


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 22, 2005 10:47 pm 
Regular
Regular

Joined: Tue Nov 09, 2004 5:15 pm
Posts: 100
This error message looks very familiar to me. I think this is caused by incorrect combination of Hibernate annotations and Hibernate versions.

For Hibernate 3.1 beta 1, i used Hibernate annotations 3.1 beta 3.

Which version of annotations are you using?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 22, 2005 11:35 pm 
Newbie

Joined: Mon Aug 22, 2005 10:09 pm
Posts: 2
As far as I know, I am using 3.1beta3. I'll double check it tomorrow to confirm that no other version sneaked into the classpath, but that is what is set up in the maven dependency.

Chris


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.