-->
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.  [ 4 posts ] 
Author Message
 Post subject: need help with SchemaExport and annotations
PostPosted: Sat Jul 02, 2005 1:27 am 
Regular
Regular

Joined: Tue Nov 09, 2004 5:15 pm
Posts: 100
Hi All,

I'm trying to create the DDL using SchemaExport ant task following the examples given in "tools.hibernate.org".

Here's my ant task:

Code:
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask">
                        <classpath>
                                        <path refid="classpath"/>
                        </classpath>
        </taskdef>
         
        <target name="schemaexport">
                <hibernatetool destdir="sql">
                                <classpath path="${build.dir}/classes"/>
                   
                   <annotationconfiguration configurationfile="config/hibernate.cfg.xml"/>
       
                   <hbm2ddl export="false" drop="false" create="true" outputfilename="xxx.sql"/>
                        <hbm2java/>
                  </hibernatetool>
        </target>


When i run the target "schemaexport" i get the following error.

Code:
--- Nested Exception ---
java.lang.NoSuchMethodError: 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/List;Ljava/util/List;Lorg/hibernate/cfg/NamingStrategy;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;)V
        at org.hibernate.cfg.ExtendedMappings.<init>(ExtendedMappings.java:43)
        at org.hibernate.cfg.AnnotationConfiguration.createExtendedMappings(AnnotationConfiguration.java:125)
        at org.hibernate.cfg.AnnotationConfiguration.addPackage(AnnotationConfiguration.java:115)
        at org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConfiguration.java:224)
        at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1201)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1183)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1159)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1122)
        at org.hibernate.tool.ant.ConfigurationTask.doConfiguration(ConfigurationTask.java:76)
        at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:50)
        at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:150)
        at org.hibernate.tool.ant.Hbm2DDLGeneratorTask.execute(Hbm2DDLGeneratorTask.java:38)
        at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:115)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
        at org.apache.tools.ant.Main.runBuild(Main.java:673)
        at org.apache.tools.ant.Main.startAnt(Main.java:188)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)



Here's my hibernate.cfg.xml

Code:
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
           
<hibernate-configuration>
        <session-factory>
<!-- jdbc connection properties -->
        <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
        <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="hibernate.connection.url">jdbc:oracle:thin:@martu.corp.apple.com:1701:exp2d</property>
        <property name="hibernate.connection.username">oradba</property>
        <property name="hibernate.connection.password">oradba</property>
       
    <!-- c3p0 connection pooling properties
    <property name="hibernate.c3p0.min_size">1</property>
    <property name="hibernate.c3p0.max_size">3</property>
         -->       
       
    <!-- other hibernate properties -->
<!--                   
    <property name="hibernate.show_sql">true</property>
    <property name="hibernate.hbm2ddl.auto">create</property>
-->
        <mapping package="com.apple.ist.espresso.admin.model"/>
                <mapping class="com.apple.ist.espresso.admin.model.ApplicationRole"/>
               
        </session-factory>
</hibernate-configuration>
~                               



I spent lot of time debugging the issue without any luck. I would like to be able to generate the .sql file from the annotations.

Could someone please let me know what's that i'm missing?

Thanks for any input in advance!

p.s

There is no issue with ApplicationRole class using hibernate annotations if i use "hbm2ddl ---> create". The table is created w/o any problems.


Top
 Profile  
 
 Post subject: Problem solved?
PostPosted: Thu Dec 01, 2005 11:51 pm 
Newbie

Joined: Thu Dec 01, 2005 11:48 pm
Posts: 8
Hi everyone,

right now i have the same problem. Has anyone solved this?

Thx for your help


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 02, 2005 12:22 am 
Regular
Regular

Joined: Tue Nov 09, 2004 5:15 pm
Posts: 100
This error means that you are not using the right (latest) version of annotations jars.


Top
 Profile  
 
 Post subject: Maybe this is the problem:
PostPosted: Fri Dec 02, 2005 12:29 am 
Newbie

Joined: Thu Dec 01, 2005 11:48 pm
Posts: 8
Hi again,

I just found out that

"Hibernate 3.1 RC3 is not compatible with Hibernate Annotation 3.1beta6. Will be with 3.1beta7"

this is from the hibernate team as stated here:

http://forum.hibernate.org/viewtopic.php?t=950266

will try some other version combinations now... :-(

thx


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