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.