-->
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.  [ 6 posts ] 
Author Message
 Post subject: hbm2java errors with hibernate-tools-3
PostPosted: Tue Jan 17, 2006 7:24 pm 
Newbie

Joined: Thu Jan 27, 2005 7:43 pm
Posts: 8
Hibernate version: 3.0.2

Mapping documents:3.0

Full stack trace of any exception that occurs:

I have upgraded from hibernate-2.1 to hibernate-3.0.2
now I'm trying to upgrade to new hibernate tools
here is my new build.xml:
Code:
     <target name="hbm2java">

        <taskdef name="hibernatetool"
   classname="org.hibernate.tool.ant.HibernateToolTask"
                   classpathref="project.class.path"/> 

        <hibernatetool destdir="${gen-src}" >
           <configuration  propertyfile="${etc}/hibernate.properties">
           <fileset dir="${src}">
   <include name="**/*.hbm.xml" />
           </fileset>
           </configuration>

           <hbm2java/>
         </hibernatetool>

    </target>


I have tried to use "HibernateTools-3.1.0.beta2" and got following exception:

[hibernatetool] (hbm2x.template 94 ) Method getJavaTypeNam
e threw exception for reference $pojo in template pojo/PojoFields.vm at [10,37]

[hibernatetool] (hbm2x.template 94 ) Method get threw exce
ption for reference $templates in template pojo/Pojo.vm at [10,1]

BUILD FAILED
C:\development\eclipse\workspace\nms\nmss\build.xml:431: org.hibernate.tool.hbm2
x.ExporterException: MethodInvocationException while processing template Pojo. I
nvocation of method 'get' in class org.hibernate.tool.hbm2x.TemplateHelper$Temp
lates threw exception class org.hibernate.tool.hbm2x.ExporterException : MethodI
nvocationException while processing template pojo/PojoFields.vm. Invocation of m
ethod 'getJavaTypeName' in class org.hibernate.tool.hbm2x.pojo.EntityPOJOClass
threw exception class org.hibernate.tool.hbm2x.ExporterException : Could not res
olve type without exception for org.hibernate.mapping.Property(parameters) Value
: org.hibernate.mapping.Array(com.crossbeamsys.nms.task.TaskDO.parameters)


now when I try to use "hibernate-tools-3.1.0.alpha5" it works, but
for my id define as:
Code:
<id name="id" type="long" column="deviceid" unsaved-value="-1">


I get generated "Long" instead of "long",

1. why is that?

2. also, in hibernate-tools 2 I could define the following

Code:
hbm2java config="${build-src}/codegen.cfg.xml" output="${gen-src}"


which allowed me to use codegen.cfg.xml and define meta tags, now I don't see anywhere in the doc on how to do that.

3. Also tried "hibernate-tools-3.0.0.alpha4a", but here I'm getting
java.lang.ExceptionInInitializerError

PLEASE HELP!!!


Top
 Profile  
 
 Post subject: HibernateTools 3.1.0b2 standalone don't work at all
PostPosted: Mon Jan 23, 2006 6:23 am 
Newbie

Joined: Mon Jan 23, 2006 6:09 am
Posts: 2
I don't seem to be able to find any configuration that works. According to the documentation the below should work, however I get exceptions.

LibraryContext

    commons-collections-2.1.1.jar
    commons-logging-1.0.4.jar
    dom4j-1.6.1.jar
    hibernate3.jar
    hibernate-tools.jar
    jta.jar
    jtidy-r8-21122004.jar
    log4j-1.2.11.jar
    velocity-1.4.jar
    velocity-tools-generic-1.1.jar


Build file

Code:
   <path id="project.libs.hibernatetools">
      <fileset dir="libhibernatetools">
         <include name="**/*.jar"/>
      </fileset>
      <filelist dir="D\:\\devtools\\mysql-connector-java-3.1.12">
         <file name="mysql-connector-java-3.1.12-bin.jar"/>
      </filelist>
   </path>

   <target name="hbm2java">
      <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="project.libs.hibernatetools"/>
      <hibernatetool destdir="src/generated">
         <classpath> <!-- a classpath is optional, but needed for exporters that require access to domain classes etc. -->
            <path location="."/>
         </classpath>
         <configuration configurationfile="hibernate.cfg.xml" />
         <hbm2java/>
     </hibernatetool>
  </target>


The exception

Code:
[hibernatetool] 11:08:08,218  INFO template:88 - ResourceManager : found pojo/PojoConstructors.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] 11:08:08,218 ERROR template:94 - Method needsMinimalConstructor threw exception for reference $pojo in template pojo/PojoConstructors.vm at  [7,6]
[hibernatetool] 11:08:08,218 ERROR template:94 - Method get threw exception for reference $templates in template pojo/Pojo.vm at  [12,1]

BUILD FAILED
D:\development\workspace\HibernateTools\build.xml:50: org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException while processing template Pojo. Invocation of method 'get' in  class org.hibernate.tool.hbm2x.TemplateHelper$Templates threw exception class org.hibernate.tool.hbm2x.ExporterException : MethodInvocationException while processing template pojo/PojoConstructors.vm. Invocation of method 'needsMinimalConstructor' in  class org.hibernate.tool.hbm2x.pojo.EntityPOJOClass threw exception class java.lang.NoSuchMethodError : org.hibernate.mapping.Property.getGeneration()Lorg/hibernate/mapping/PropertyGeneration;
   at org.apache.tools.ant.Task.perform(Task.java:373)
   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.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
   at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
   at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
Caused by: org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException while processing template Pojo. Invocation of method 'get' in  class org.hibernate.tool.hbm2x.TemplateHelper$Templates threw exception class org.hibernate.tool.hbm2x.ExporterException : MethodInvocationException while processing template pojo/PojoConstructors.vm. Invocation of method 'needsMinimalConstructor' in  class org.hibernate.tool.hbm2x.pojo.EntityPOJOClass threw exception class java.lang.NoSuchMethodError : org.hibernate.mapping.Property.getGeneration()Lorg/hibernate/mapping/PropertyGeneration;
   at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:150)
   at org.hibernate.tool.hbm2x.VelocityProducer.firstPass(VelocityProducer.java:74)
   at org.hibernate.tool.hbm2x.VelocityProducer.produce(VelocityProducer.java:28)
   at org.hibernate.tool.hbm2x.VelocityProducer.produce(VelocityProducer.java:112)
   at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:112)
   at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:100)
   at org.hibernate.tool.hbm2x.GenericExporter.exportClasses(GenericExporter.java:83)
   at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:68)
   at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:90)
   at org.hibernate.tool.hbm2x.GenericExporter.start(GenericExporter.java:58)
   at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:39)
   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)
   ... 9 more
Caused by: org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException while processing template pojo/PojoConstructors.vm. Invocation of method 'needsMinimalConstructor' in  class org.hibernate.tool.hbm2x.pojo.EntityPOJOClass threw exception class java.lang.NoSuchMethodError : org.hibernate.mapping.Property.getGeneration()Lorg/hibernate/mapping/PropertyGeneration;
   at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:150)
   at org.hibernate.tool.hbm2x.TemplateHelper$Templates.get(TemplateHelper.java:108)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.apache.velocity.runtime.parser.node.GetExecutor.execute(GetExecutor.java:65)
   at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:302)
   at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:157)
   at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
   at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:220)
   at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
   at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:70)
   at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
   at org.apache.velocity.Template.merge(Template.java:256)
   at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:450)
   at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:419)
   at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:138)
   ... 22 more
Caused by: java.lang.NoSuchMethodError: org.hibernate.mapping.Property.getGeneration()Lorg/hibernate/mapping/PropertyGeneration;
   at org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.isRequired(BasicPOJOClass.java:559)
   at org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.getPropertiesForMinimalConstructor(EntityPOJOClass.java:699)
   at org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.getPropertyClosureForMinimalConstructor(EntityPOJOClass.java:678)
   at org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.getPropertyClosureForMinimalConstructor(EntityPOJOClass.java:673)
   at org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.needsMinimalConstructor(BasicPOJOClass.java:577)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:267)
   at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:197)
   at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
   at org.apache.velocity.runtime.parser.node.ASTReference.evaluate(ASTReference.java:307)
   at org.apache.velocity.runtime.parser.node.ASTExpression.evaluate(ASTExpression.java:45)
   at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:68)
   at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
   at org.apache.velocity.Template.merge(Template.java:256)
   at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:450)
   at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:419)
   at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:138)
   ... 39 more


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 7:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i'm pretty sure you are not using the hibernate that comes with the tools release together with the tools.

using hibernate 3.1 final should work though.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 7:36 am 
Newbie

Joined: Mon Jan 23, 2006 6:09 am
Posts: 2
Max,

you were absolutely right. I was using Hibernate 3.1 (12/12/2005) and was ignorant of the fact that the the 3.1.0b2 tools apperantly require 3.1rc3 or newer(the labels '3.1' and '3.1rc3' taken from the jar manifest.

I just combined Hibernate 3.1.1 and verified it works correctly with the 3.1.0b2 Tools. I noticed that the manifest of the tools jar doesn't contain a version. It could be a good idea to make sure the jar manifest version always reflects the exact same version advertised. This would makes it even easier to check which versions I have running in what environmnet.

Thanks again,
Walter


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 11:43 am 
Newbie

Joined: Thu Jan 27, 2005 7:43 pm
Posts: 8
ok, so which hibernate tool should I run with hibernate-3.0.2?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 1:07 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
just the latest. the output of the tools works with any 3.x version.

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