-->
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.  [ 2 posts ] 
Author Message
 Post subject: one-to-many throwing strange error
PostPosted: Wed Sep 07, 2005 10:51 am 
Beginner
Beginner

Joined: Wed Jul 06, 2005 4:51 pm
Posts: 27
one-to-many relation with not-null attribute on key element is throwing below error when I run the hbm2java tool. I have a based class with a joined-subclass and the joined subclass have one-to-many relationship with another class. When I specify not-null attribute on the key element in the list element I get the below error. If I remove it I don't get this error. Then I went and manually edited the mapping file and persistence goes on fine. It is only the tool that is misbehaving.

---------> Mapping
Base class mapping:
<hibernate-mapping package="***.core">
<class name="Resource" table="Resource" polymorphism="explicit">
..............
</class>

Derived Class with one-to-many:
<hibernate-mapping package="***.chartbook">
<joined-subclass name="ChartDefinition" table="ChartDefinition"
extends="***.core.Resource">
<key column="chartDefinitionId"/>
.....
<list name="ChartSeries" cascade="all-delete-orphan" inverse="false">
<key column="chartDefinitionId" not-null="true"/>
<list-index column="position" />
<one-to-many class="ChartSeries"/>
</list>
</joined-subclass>
</hibernate-mapping>

--- target of one-to-many
<hibernate-mapping package="**.chartbook">
<class name="ChartSeries" table="ChartSeries">
<id name="Id" type="integer" column="chartSeriesId">
<generator class="identity"/>
</id>
</class>
</hibernate-mapping>

----------------> Error
org.hibernate.tool.hbm2x.ExporterException: Error while processing t
emplate pojo/javaclass.vm
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.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: org.hibernate.tool.hbm2x.ExporterException: Error while processing template pojo/javaclass.vm
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:89)
at org.hibernate.tool.hbm2x.POJOExporter.runVelocity(POJOExporter.java:78)
at org.hibernate.tool.hbm2x.POJOExporter.exportPersistentClass(POJOExporter.java:61)
at org.hibernate.tool.hbm2x.POJOExporter.start(POJOExporter.java:111)
at org.hibernate.tool.ant.GeneratorTask.execute(GeneratorTask.java:33)
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)
... 10 more
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getFieldModifiers' in class org.hi
bernate.tool.hbm2x.Cfg2JavaTool threw exception class java.lang.NullPointerException : null
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:246)
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.directive.Foreach.render(Foreach.java:166)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114)
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:81)
... 17 more


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 08, 2005 1:39 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Which version of the tools are you using?


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