-->
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 fails in inheritance
PostPosted: Thu Oct 20, 2005 4:00 pm 
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 base class with a joined-subclass and the joined subclass has one-to-many relationship with another class. The one-to-many uses a list. When I specify not-null attribute on the key element in the relationship I get the below error. If I remove it I don't get this error. If I let the key stay not-null, during run time persistence fails. So I had to revert the mapping file at runtime for the persistence to go 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)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 5:34 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
please put this in jira thanks.

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