-->
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.  [ 10 posts ] 
Author Message
 Post subject: Alter staments of <hbm2ddl> are not written to output
PostPosted: Mon Nov 14, 2005 3:25 am 
Beginner
Beginner

Joined: Tue Dec 21, 2004 3:18 am
Posts: 32
Hi,
I have been trying to use hibernate tools to write the database schema updates to an external file.
But I realized the following, if I add a new property to certain class and then run the hibernateToolTask nothing is written to the outputfile (it's not even created).

I'm using hibernate 3 ,spring framework 1.2 and hibernate tools alpha5.

Here is my ant task.

Code:
<path id="hibernateTool.classpath">
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="hibernate3.jar"/>
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="hibernate-tools*.jar"/>
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="mysql-connector-java*.jar"/>
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="velocity*.jar"/>
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="jtidy*.jar"/>
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="commons*.jar"/>
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="hibernate-annotations.jar"/>
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="dom4j*.jar"/>
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="ejb3-persistence.jar"/>
      <pathelement location="${tomcat.home}/webapps/4s/WEB-INF/classes"/>
   </path>
         
   <target name="hibernatetool">
       <taskdef name="hibernatetool"
              classname="org.hibernate.tool.ant.HibernateToolTask"
              classpathref="hibernateTool.classpath"/>
         
      <hibernatetool destdir="${tomcat.home}/webapps/4s/ant">
         
         <annotationconfiguration configurationfile="hibernate.cfg.xml"/>
         <hbm2ddl
            export="false"
            drop="false"
            update="true"
            outputfilename="schema.sql"
            delimiter = ";"/>
      </hibernatetool>
   </target>


I don't no what's the problem I see the alter statment written to the console but nothing is written to the output file.

I f anyone could help me I would be very thankful.

Thanks in Advance.

Sherihan.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 7:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
why dont you use the beta1 tools ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 7:40 am 
Beginner
Beginner

Joined: Tue Dec 21, 2004 3:18 am
Posts: 32
Hi,
I was using beta version of hibernate tools but I used to get the following error:

Code:
/home/smagied/dev/eclipse/production/4s/ant/ant.xml:76: Problems in creating a AnnotationConfiguration. Have you remembered to add it to the classpath ?
   at org.hibernate.tool.ant.AnnotationConfigurationTask.createConfiguration(AnnotationConfigurationTask.java:30)
   at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:54)
   at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:180)
   at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:35)
   at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:144)
   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.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:416)
   at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:138)
Caused by: java.lang.NoSuchMethodError: org.hibernate.util.ReflectHelper.classForName(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Class;
   at org.hibernate.tool.ant.AnnotationConfigurationTask.createConfiguration(AnnotationConfigurationTask.java:26)
   ... 14 more
--- Nested Exception ---
java.lang.NoSuchMethodError: org.hibernate.util.ReflectHelper.classForName(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Class;
   at org.hibernate.tool.ant.AnnotationConfigurationTask.createConfiguration(AnnotationConfigurationTask.java:26)
   at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:54)
   at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:180)
   at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:35)
   at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:144)
   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.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:416)
   at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:138)



When I searched the forum and I found someone saying that this a common error in the beta version so we have to use the alpha version instead.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 7:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
its not a common error in the beta software, it is a common error that users try to use random versions of hibernate3 with the beta tools ;)

just use the hibernate3 core that comes with the tools to avoid all this.

does not affect your hibernate3 used in your production etc.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 8:07 am 
Beginner
Beginner

Joined: Tue Dec 21, 2004 3:18 am
Posts: 32
I tried using hibernate3.jar and hibernate-tools.jar in beta1 and I got the following error:

Code:
BUILD FAILED
java.lang.NoClassDefFoundError: org/hibernate/cfg/HbmBinder$SecondPass


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 8:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
use a newer hibernate annotations.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 8:38 am 
Beginner
Beginner

Joined: Tue Dec 21, 2004 3:18 am
Posts: 32
I replaced all the required jars with the ones in hibernate-tools beta1 then I got the following error:

Code:
BUILD FAILED
java.lang.NoClassDefFoundError: javax/transaction/SystemException


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 8:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you are missing jta.jar

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 8:52 am 
Beginner
Beginner

Joined: Tue Dec 21, 2004 3:18 am
Posts: 32
The hibernateToolTask ran without errors but no file was created though I see the alter statment written to the console.

So, we are back to the same problem I mentioned at the begining of the thread.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 8:58 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
I know that it works because i have just as recent as today run several tests for it. The only bug i found were that we did not report all exceptions on the ant log output.

Could you try and put a log4j.properties (and a log4j.jar) in the classpath and see what it tells you.

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