Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: <hbm2hbmxml/> strange new error
PostPosted: Fri Nov 09, 2007 4:39 am 
Newbie

Joined: Fri Nov 09, 2007 4:26 am
Posts: 1
Location: Johannesburg South Africa
Hey guys,

I am using the hbm2hbmxml tools to produce hbm.xml mapping files from my annotated entities. This has worked in the past but I am now getting a very strange error after making several changes to my entities.

Hibernate version: 3.2
Hibernate Tools version:[b] 3.2.0 beta9a

[b]Mapping documents:
Annotated Mappings

Full stack trace of any exception that occurs:

BUILD FAILED
C:\myprojects\sve\build.xml:150: org.hibernate.tool.hbm2x.Export
erException: Error while processing template hbm/hibernate-mapping.hbm.ftl
at org.hibernate.tool.ant.HibernateToolTask.reportException(HibernateToo
lTask.java:223)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.ja
va:186)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a: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(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.Main.runBuild(Main.java:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: org.hibernate.tool.hbm2x.ExporterException: Error while processing te
mplate hbm/hibernate-mapping.hbm.ftl
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
r.java:253)
at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplatePro
ducer.java:67)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja
va:28)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja
va:97)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.j
ava:146)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(Generi
cExporter.java:135)
at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.ja
va:41)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java
:126)
at org.hibernate.tool.hbm2x.HibernateMappingExporter.doStart(HibernateMa
ppingExporter.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.ja
va:183)
... 16 more
Caused by: freemarker.template.TemplateException: Error reading included file hb
m/one-to-one.hbm.ftl
at freemarker.core.Include.accept(Include.java:153)
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:1378)
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(TemplateHelpe
r.java:247)
... 27 more
Caused by: java.io.FileNotFoundException: Template hbm/one-to-one.hbm.ftl not fo
und.
at freemarker.template.Configuration.getTemplate(Configuration.java:489)

at freemarker.core.Environment.getTemplateForInclusion(Environment.java:
1360)
at freemarker.core.Include.accept(Include.java:143)
... 44 more
--- Nested Exception ---
org.hibernate.tool.hbm2x.ExporterException: Error while processing template hbm/
hibernate-mapping.hbm.ftl
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
r.java:253)
at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplatePro
ducer.java:67)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja
va:28)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja
va:97)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.j
ava:146)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(Generi
cExporter.java:135)
at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.ja
va:41)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java
:126)
at org.hibernate.tool.hbm2x.HibernateMappingExporter.doStart(HibernateMa
ppingExporter.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.ja
va:183)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a: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(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.Main.runBuild(Main.java:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: freemarker.template.TemplateException: Error reading included file hb
m/one-to-one.hbm.ftl
at freemarker.core.Include.accept(Include.java:153)
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:1378)
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(TemplateHelpe
r.java:247)
... 27 more
Caused by: java.io.FileNotFoundException: Template hbm/one-to-one.hbm.ftl not fo
und.
at freemarker.template.Configuration.getTemplate(Configuration.java:489)

at freemarker.core.Environment.getTemplateForInclusion(Environment.java:
1360)
at freemarker.core.Include.accept(Include.java:143)
... 44 more


Any assistence would be greatly appreciated.

thanks
Stinky


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 10, 2007 6:41 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8611
Location: Neuchatel, Switzerland (Danish)
1) the reason for the failure is that one-to-one transformation is not implemented.

2) why are you dependent on converting annotations to hbm.xml on a regular basis ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Why not?
PostPosted: Fri May 09, 2008 7:01 pm 
Newbie

Joined: Mon Mar 17, 2008 3:07 pm
Posts: 8
There is at least one application: a modeler/designer could transform Hibernate3 annotated classes to Hibernate3 hbm files to be converted, in its turn, to Hibernate2 hbm file...
I applied this approach when I had to model/design entity classes by using Hibernate3 annotations before to submit the mapping files to an external software factory should use a Hibernate2-based architecture.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 10, 2008 4:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8611
Location: Neuchatel, Switzerland (Danish)
there a big differencees in the semantics between h2 and h3 mapping files. I don't hope you just blindly generated these files and used them in production....

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Why not, again?
PostPosted: Sun May 11, 2008 11:40 am 
Newbie

Joined: Mon Mar 17, 2008 3:07 pm
Posts: 8
Well, indeed, we had to make that work for us...
First of all, we had to create a converter from Hibernate3 to Hibernate2 hbm format.
It was not so hard due to the high similarity between these formats.
One important aspect is that DDL script was generated by using Hibernate3 mapping directly. So, some physical information hadn't to be generated.
Only two limitations we faced and solved:
- Hibernate tools wasn't able to generate component details in Hibernate3's hbm format. We had to implement this feature in our specific context.
- We had to inject unsaved-value information into the generated hbm files, because this is not present in Hibernate3 annotation schema.


Top
 Profile  
 
 Post subject: Re: Why not, again?
PostPosted: Sun May 11, 2008 1:30 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8611
Location: Neuchatel, Switzerland (Danish)
Edmundo de Andrade wrote:
- Hibernate tools wasn't able to generate component details in Hibernate3's hbm format. We had to implement this feature in our specific context.


what does that mean ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Why not?
PostPosted: Sun May 11, 2008 10:28 pm 
Newbie

Joined: Mon Mar 17, 2008 3:07 pm
Posts: 8
There is a specific topic for that hibernatetools' limitation intitled "hbm2hbmxml doesn't export components":

http://forum.hibernate.org/viewtopic.php?t=985523&start=0&postdays=0&postorder=asc&highlight=


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 12, 2008 4:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8611
Location: Neuchatel, Switzerland (Danish)
That still does not make any sense. hbm2hbmxml works fine with components, no extra steps are needed.

Are you sure you are talking about hbm2hbmxml ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 04, 2008 3:55 am 
Beginner
Beginner

Joined: Wed Jan 31, 2007 6:54 am
Posts: 22
max wrote:
1) the reason for the failure is that one-to-one transformation is not implemented.


I struggled with this error as well for quite some time before finding this post. A huge improvement would be an error message telling the user that one-to-one is not implemented instead of the cryptic "error reading file". Would have saved me and probably other people some time...


Top
 Profile  
 
 Post subject: Re: <hbm2hbmxml/> strange new error
PostPosted: Fri Feb 24, 2012 11:49 am 
Newbie

Joined: Fri Feb 24, 2012 10:36 am
Posts: 1
I solved this problem by adding a more recent version of hibernate-tools to the plugin's dependencies

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-tools</artifactId>
<version>3.2.4.GA</version>
</dependency>

This version of hibernate tools has the one-to-one mapping template.
By default version 2.2 of the hibernate3-maven-plugin uses hibernate-tools 3.2.3, you need to override that version.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.