-->
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: hbm2hbmxml ExporterException for Set<Integer>
PostPosted: Mon Jul 14, 2008 9:55 am 
Newbie

Joined: Mon Jul 14, 2008 9:04 am
Posts: 1
I'm using tools version 3.2.2 Beta.

I'm trying to generate Hibernate mapping files from classes with mapping annotations and an getting an exception when a class has a Set of Integers. My class is:

Code:
@Entity
public class IntegerHolder {

   @Id @GeneratedValue
   private Long id = null;
   
   @org.hibernate.annotations.CollectionOfElements
   @JoinTable(
      name = "HOLDER_INT",
      joinColumns = @JoinColumn(name = "HOLDER_ID")
                     
   )
   private Set<Integer> ints = null;

   // ...
}


Which works fine when persisting. When running it through hbm2hbmxml an exception occours (full trace and end of post):

Code:
org.hibernate.tool.hbm2x.ExporterException: Error while processing Entity: ck.IntegerHolder with template hbm/hibernate-mapping.hbm.ftl

The root cause appears to be:

Code:
Caused by: freemarker.core.InvalidReferenceException: Expression property.getValue().getElement().getReferencedEntityName is undefined on line 24, column 41 in hbm/set.hbm.ftl.


It looks like the template can't work out the type of my Set from the code, is this correct? How should I make it work?

Thanks


Full trace:
Code:
[hibernatetool] org.hibernate.tool.hbm2x.ExporterException: Error while processing Entity: ck.IntegerHolder with template hbm/hibernate-mapping.hbm.ftl
[hibernatetool] freemarker.core.InvalidReferenceException: Expression property.getValue().getElement().getReferencedEntityName is undefined on line 24, column 41 in hbm/set.hbm.ftl.

BUILD FAILED
C:\eclipse\eclipse-3-3\workspace\com.enigmatec.ems.platform-hibernate-exp\generate-xml-mappings-build.xml:22: org.hibernate.tool.hbm2x.ExporterException: Error while processing Entity: ck.IntegerHolder with template hbm/hibernate-mapping.hbm.ftl
   at org.hibernate.tool.ant.HibernateToolTask.reportException(HibernateToolTask.java:226)
   at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:189)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
   at org.apache.tools.ant.Task.perform(Task.java:348)
   at org.apache.tools.ant.Target.execute(Target.java:357)
   at org.apache.tools.ant.Target.performTasks(Target.java:385)
   at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
   at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
   at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
   at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
   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: Error while processing Entity: ck.IntegerHolder with template hbm/hibernate-mapping.hbm.ftl
   at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:261)
   at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:67)
   at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
   at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:103)
   at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:148)
   at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:137)
   at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.java:43)
   at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:128)
   at org.hibernate.tool.hbm2x.HibernateMappingExporter.doStart(HibernateMappingExporter.java:34)
   at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
   at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
   at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)
   ... 16 more
Caused by: freemarker.core.InvalidReferenceException: Expression property.getValue().getElement().getReferencedEntityName is undefined on line 24, column 41 in hbm/set.hbm.ftl.
   at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
   at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
   at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:114)
   at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
   at freemarker.core.Expression.getStringValue(Expression.java:93)
   at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.IfBlock.accept(IfBlock.java:82)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.Environment.include(Environment.java:1375)
   at freemarker.core.Include.accept(Include.java:155)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:160)
   at freemarker.core.Environment.visit(Environment.java:351)
   at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.Environment.include(Environment.java:1375)
   at freemarker.core.Include.accept(Include.java:155)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.Environment.process(Environment.java:176)
   at freemarker.template.Template.process(Template.java:232)
   at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:255)
   ... 27 more
--- Nested Exception ---
org.hibernate.tool.hbm2x.ExporterException: Error while processing Entity: ck.IntegerHolder with template hbm/hibernate-mapping.hbm.ftl
   at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:261)
   at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:67)
   at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
   at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:103)
   at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:148)
   at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:137)
   at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.java:43)
   at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:128)
   at org.hibernate.tool.hbm2x.HibernateMappingExporter.doStart(HibernateMappingExporter.java:34)
   at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
   at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
   at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
   at org.apache.tools.ant.Task.perform(Task.java:348)
   at org.apache.tools.ant.Target.execute(Target.java:357)
   at org.apache.tools.ant.Target.performTasks(Target.java:385)
   at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
   at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
   at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
   at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
   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: freemarker.core.InvalidReferenceException: Expression property.getValue().getElement().getReferencedEntityName is undefined on line 24, column 41 in hbm/set.hbm.ftl.
   at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
   at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
   at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:114)
   at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
   at freemarker.core.Expression.getStringValue(Expression.java:93)
   at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.IfBlock.accept(IfBlock.java:82)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.Environment.include(Environment.java:1375)
   at freemarker.core.Include.accept(Include.java:155)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:160)
   at freemarker.core.Environment.visit(Environment.java:351)
   at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.Environment.include(Environment.java:1375)
   at freemarker.core.Include.accept(Include.java:155)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:196)
   at freemarker.core.Environment.process(Environment.java:176)
   at freemarker.template.Template.process(Template.java:232)
   at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:255)
   ... 27 more



Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 06, 2008 5:36 am 
Newbie

Joined: Thu Jul 05, 2007 6:09 am
Posts: 3
Having exactly the same issue here. Is there a workaround available for this behaviour?

Code:
   @CollectionOfElements
   @JoinTable(
      name="my_join_table",
           joinColumns=@JoinColumn(name="element_id")
   )


When deleting these lines the hbm.xml files get generated correctly.

I put this issue in Jira


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.