-->
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.  [ 7 posts ] 
Author Message
 Post subject: hbm2ddl makes drop statements with drop="false" se
PostPosted: Tue Dec 13, 2005 4:19 am 
Beginner
Beginner

Joined: Thu Oct 16, 2003 7:25 pm
Posts: 38
Location: New York City
I'm using annotations in my pojo classes, and I have an Ant task to output a DDL file from those classes. But, even though I specify drop="false" in the hbm2ddl task, the drop statements are still generated. Why? Bug?

I'm using MySQL 4.0.17 with MySQL Connector 3.0.14.

Here's an excerpt from my Ant file:

Code:
  <target name="generate-schema" depends="">
    <hibernatetool destdir="${sql.dir}">
      <classpath>
        <path refid="compile-classpath"/>
        <pathelement location="${build.classes}"/>
      </classpath>
      <annotationconfiguration configurationfile="./hibernate.cfg.xml"/>
      <hbm2ddl create="true" drop="false" export="false" outputfilename="whatever.sql"/>
    </hibernatetool>
  </target>


And here's the contents of my hibernate.cfg.xml:
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory name="java:hibernate/SessionFactory">
    <property name="hibernate.connection.url">jdbc:mysql://192.168.2.5:3306/housing</property>
    <property name="hibernate.connection.username">housing</property>
    <property name="hibernate.connection.password">housing</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
    <property name="hibernate.default_catalog">housing</property>
    <property name="hibernate.show_sql">false</property>
    <property name="hibernate.use_sql_comments">false</property>
    <mapping package="org.jini.housing.data"/>
    <mapping class="org.jini.housing.data.Housing"/>
    <mapping class="org.jini.housing.data.HousingProperty"/>
    <mapping class="org.jini.housing.data.Neighborhood"/>
    <mapping class="org.jini.housing.data.Tenant"/>
    <mapping class="org.jini.housing.data.TenantProperty"/>
    <mapping class="org.jini.housing.data.TenantType"/>
    <mapping class="org.jini.housing.data.TenantVersion"/>
    <mapping class="org.jini.housing.data.TenantVersionProperty"/>
  </session-factory>
</hibernate-configuration>


Hibernate version:
Hibernate 3.1rc1
Hibernate Annotations 3.1beta6
Hibernate Tools 3.0alpha1


Top
 Profile  
 
 Post subject: Tried to upgrade to 3.1.0beta2, major failure
PostPosted: Tue Dec 13, 2005 4:34 am 
Beginner
Beginner

Joined: Thu Oct 16, 2003 7:25 pm
Posts: 38
Location: New York City
After downloading and replacing the hibernate-tools.jar with the newest one, 3.1.0beta2, I now get:

Code:
java.lang.IllegalAccessError: tried to access method org.hibernate.tool.hbm2ddl.SchemaExport.execute(ZZZZ)V from
class org.hibernate.tool.ant.Hbm2DDLExporterTask
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1225)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: java.lang.IllegalAccessError: tried to access method org.hibernate.tool.hbm2ddl.SchemaExport.execute(ZZZZ)V from class org.hibernate.tool.ant.Hbm2DDLExporterTask
        at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:55)
        at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:143)
        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.executeSortedTargets(Project.java:1216)
        ... 7 more
--- Nested Exception ---
java.lang.IllegalAccessError: tried to access method org.hibernate.tool.hbm2ddl.SchemaExport.execute(ZZZZ)V from class org.hibernate.tool.ant.Hbm2DDLExporterTask
        at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:55)
        at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:143)
        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.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)

[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 13, 2005 4:38 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
use the hibernate that comes with the tools (or just use the just released hibernate 3.1)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Will that work with Annotations 3.1beta6?
PostPosted: Tue Dec 13, 2005 4:52 am 
Beginner
Beginner

Joined: Thu Oct 16, 2003 7:25 pm
Posts: 38
Location: New York City
Will that work with Annotations 3.1beta6?

I realize that these subprojects are all in development/beta, but I'm a little confused.

Hibernate Annotations 3.1beta6 requires Hibernate 3.1rc1. That is the latest version available.

Tom


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 13, 2005 5:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
annotations should soon be out with a full release. Until then try to just use the annotaitons that i bundle with the tools (just for the schema generation)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Thanks!!
PostPosted: Tue Dec 13, 2005 5:18 am 
Beginner
Beginner

Joined: Thu Oct 16, 2003 7:25 pm
Posts: 38
Location: New York City
Using the following jars from the HibernateTools-3.1.0.beta2.zip solved both problems!

For others' sanity, here's the latest compatible versions of the libraries:
hibernate3.jar - 3.1.rc3
hibernate-annotations.jar- 3.1beta7
hibernate-tools.jar - 3.1.0beta2

I'm not sure if that beta2 zip really contains hibernate 3.1rc3 or the new release version, if perhaps, the manifest file in there wasn't updated.

Thanks again!

Tom


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 13, 2005 5:50 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
they are the latest build that worked with the tools - now that 3.1 has come out life should be much easier soon ;)

_________________
Max
Don't forget to rate


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