-->
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.  [ 3 posts ] 
Author Message
 Post subject: Template file not found when using hbm2hbmxml task
PostPosted: Mon Feb 05, 2007 9:15 pm 
Newbie

Joined: Fri Feb 02, 2007 8:25 pm
Posts: 5
Location: San Francisco, CA
Is this a bug or are maps not supported?

Hibernate version: 3.2.0
Hibernate Tools version: 3.2.0beta9a

Annotated Entities:
Code:
@javax.persistence.Entity
class Foo {
    @javax.persistence.Id Integer id;
    @javax.persistence.OneToMany java.util.Map<String,Bar> bars;
}
@javax.persistence.Entity
class Bar {
    @javax.persistence.Id Integer id;
}


Full stack trace of any exception that occurs:
Quote:
[hibernatetool] Executing Hibernate Tool with a Hibernate Annotation/EJB3 Configuration
[hibernatetool] 1. task: hbm2hbmxml (Generates a set of hbm.xml files)
[hibernatetool] [17:12:04.410] ERROR Log4JLoggerFactory.java:96
[hibernatetool] Error reading included file hbm/map.hbm.ftl
[hibernatetool] The problematic instruction:
[hibernatetool] ----------
[hibernatetool] ==> include "${c2h.getTag(property)}.hbm.ftl" [on line 93, column 1 in hbm/persistentclass.hbm.ftl]
[hibernatetool] in include "persistentclass.hbm.ftl" [on line 34, column 1 in hbm/hibernate-mapping.hbm.ftl]
[hibernatetool] ----------

[hibernatetool] Java backtrace for programmers:
[hibernatetool] ----------
[hibernatetool] freemarker.template.TemplateException: Error reading included file hbm/map.hbm.ftl
[hibernatetool] at freemarker.core.Include.accept(Include.java:153)
[hibernatetool] at freemarker.core.Environment.visit(Environment.java:196)
[hibernatetool] at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
[hibernatetool] at freemarker.core.Environment.visit(Environment.java:196)
[hibernatetool] at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:160)
[hibernatetool] at freemarker.core.Environment.visit(Environment.java:351)
[hibernatetool] at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
[hibernatetool] at freemarker.core.Environment.visit(Environment.java:196)
[hibernatetool] at freemarker.core.MixedContent.accept(MixedContent.java:92)
[hibernatetool] at freemarker.core.Environment.visit(Environment.java:196)
[hibernatetool] at freemarker.core.Environment.include(Environment.java:1375)
[hibernatetool] at freemarker.core.Include.accept(Include.java:155)
[hibernatetool] at freemarker.core.Environment.visit(Environment.java:196)
[hibernatetool] at freemarker.core.MixedContent.accept(MixedContent.java:92)
[hibernatetool] at freemarker.core.Environment.visit(Environment.java:196)
[hibernatetool] at freemarker.core.Environment.process(Environment.java:176)
[hibernatetool] at freemarker.template.Template.process(Template.java:232)
[hibernatetool] at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:247)
[hibernatetool] at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:67)
[hibernatetool] at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
[hibernatetool] at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:97)
[hibernatetool] at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:146)
[hibernatetool] at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:135)
[hibernatetool] at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.java:41)
[hibernatetool] at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:126)
[hibernatetool] at org.hibernate.tool.hbm2x.HibernateMappingExporter.doStart(HibernateMappingExporter.java:34)
[hibernatetool] at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
[hibernatetool] at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
[hibernatetool] at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:183)
[hibernatetool] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[hibernatetool] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatetool] at org.apache.tools.ant.Target.execute(Target.java:341)
[hibernatetool] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[hibernatetool] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[hibernatetool] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
[hibernatetool] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
[hibernatetool] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[hibernatetool] at org.apache.tools.ant.Main.runBuild(Main.java:668)
[hibernatetool] at org.apache.tools.ant.Main.startAnt(Main.java:187)
[hibernatetool] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
[hibernatetool] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
[hibernatetool] Caused by: java.io.FileNotFoundException: Template hbm/map.hbm.ftl not found.
[hibernatetool] at freemarker.template.Configuration.getTemplate(Configuration.java:489)
[hibernatetool] at freemarker.core.Environment.getTemplateForInclusion(Environment.java:1357)
[hibernatetool] at freemarker.core.Include.accept(Include.java:143)
[hibernatetool] ... 40 more
[hibernatetool] An exception occurred while running exporter #2:hbm2hbmxml (Generates a set of hbm.xml files)
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.tool.hbm2x.ExporterException: Error while processing template hbm/hibernate-mapping.hbm.ftl
[hibernatetool] freemarker.template.TemplateException: Error reading included file hbm/map.hbm.ftl
[hibernatetool] java.io.FileNotFoundException: Template hbm/map.hbm.ftl not found.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 08, 2007 5:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
map support is not yet implemented for hbm2hbmxml.

submit to jira (patches also welcome ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Template file not found when using hbm2hbmxml task
PostPosted: Mon Feb 25, 2008 1:58 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
I have the same error occuring although I am not using annotation or Maps.

Here is my ant task

Code:
<hibernatetool destdir="generated">
      <!--<configuration propertyfile="hibernate.properties"/>-->
      <jdbcconfiguration propertyfile="hibernate.properties" revengfile="revenge.xml" />
      <hbm2hbmxml/>


My revenge.xml file is as follows

Code:
<hibernate-reverse-engineering>
   <schema-selection match-schema="sentineldev"/>
   <type-mapping>
      <!-- jdbc-type is name fom java.sql.Types -->
      <sql-type jdbc-type="VARCHAR" length='20'
         hibernate-type="string" />
      <sql-type jdbc-type="VARCHAR" length='1'
         hibernate-type="char" />
      <!-- length, scale and precision can be used to specify the mapping precisly -->
      <sql-type jdbc-type="NUMERIC" precision='1'
         hibernate-type="boolean" />
      <!-- the type-mappings are ordered. This mapping will be consulted last,
         thus overriden by the previous one if precision=1 for the column -->
      <sql-type jdbc-type="NUMERIC" hibernate-type="long" />
   </type-mapping>
</hibernate-reverse-engineering>


Following is the complete log and stack trace

[hibernatetool] Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
[hibernatetool] 1. task: hbm2hbmxml (Generates a set of hbm.xml files)
[hibernatetool] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
[hibernatetool] log4j:WARN Please initialize the log4j system properly.
[hibernatetool] An exception occurred while running exporter #2:hbm2hbmxml (Generates a set of hbm.xml files)
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.tool.hbm2x.ExporterException: Error while processing template hbm/hibernate-mapping.hbm.ftl
[hibernatetool] freemarker.template.TemplateException: Error reading included file hbm/${c2h.getTag(property)}.hbm.ftl
[hibernatetool] java.io.FileNotFoundException: Template hbm/${c2h.getTag(property)}.hbm.ftl not found.

BUILD FAILED
C:\dnb1\sentinel\local\SentinelHBMProject\build.xml:18: org.hibernate.tool.hbm2x.ExporterException: Error while processing 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:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:142)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.parseBuildFile(InternalAntRunner.java:191)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:400)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
Caused by: org.hibernate.tool.hbm2x.ExporterException: Error while processing template hbm/hibernate-mapping.hbm.ftl
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:257)
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:97)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:146)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:135)
at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.java:41)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:126)
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)
... 7 more
Caused by: freemarker.template.TemplateException: Error reading included file hbm/${c2h.getTag(property)}.hbm.ftl
at freemarker.template.Include.accept(Include.java:163)
at freemarker.template.Environment.visit(Environment.java:180)
at freemarker.template.MixedContent.accept(MixedContent.java:91)
at freemarker.template.Environment.visit(Environment.java:180)
at freemarker.template.ConditionalBlock.accept(ConditionalBlock.java:78)
at freemarker.template.Environment.visit(Environment.java:180)
at freemarker.template.MixedContent.accept(MixedContent.java:91)
at freemarker.template.Environment.visit(Environment.java:180)
at freemarker.template.Environment.include(Environment.java:1018)
at freemarker.template.Environment.include(Environment.java:964)
at freemarker.template.Include.accept(Include.java:153)
at freemarker.template.Environment.visit(Environment.java:180)
at freemarker.template.MixedContent.accept(MixedContent.java:91)
at freemarker.template.Environment.visit(Environment.java:180)
at freemarker.template.Environment.process(Environment.java:166)
at freemarker.template.Template.process(Template.java:238)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:251)
... 18 more
Caused by: java.io.FileNotFoundException: Template hbm/${c2h.getTag(property)}.hbm.ftl not found.
at freemarker.template.Configuration.getTemplate(Configuration.java:450)
at freemarker.template.Environment.include(Environment.java:963)
at freemarker.template.Include.accept(Include.java:153)
... 34 more
--- Nested Exception ---
org.hibernate.tool.hbm2x.ExporterException: Error while processing template hbm/hibernate-mapping.hbm.ftl
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:257)
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:97)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:146)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:135)
at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.java:41)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:126)
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:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:142)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.parseBuildFile(InternalAntRunner.java:191)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:400)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
Caused by: freemarker.template.TemplateException: Error reading included file hbm/${c2h.getTag(property)}.hbm.ftl
at freemarker.template.Include.accept(Include.java:163)
at freemarker.template.Environment.visit(Environment.java:180)
at freemarker.template.MixedContent.accept(MixedContent.java:91)
at freemarker.template.Environment.visit(Environment.java:180)
at freemarker.template.ConditionalBlock.accept(ConditionalBlock.java:78)
at freemarker.template.Environment.visit(Environment.java:180)
at freemarker.template.MixedContent.accept(MixedContent.java:91)
at freemarker.template.Environment.visit(Environment.java:180)
at freemarker.template.Environment.include(Environment.java:1018)
at freemarker.template.Environment.include(Environment.java:964)
at freemarker.template.Include.accept(Include.java:153)
at freemarker.template.Environment.visit(Environment.java:180)
at freemarker.template.MixedContent.accept(MixedContent.java:91)
at freemarker.template.Environment.visit(Environment.java:180)
at freemarker.template.Environment.process(Environment.java:166)
at freemarker.template.Template.process(Template.java:238)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:251)
... 18 more
Caused by: java.io.FileNotFoundException: Template hbm/${c2h.getTag(property)}.hbm.ftl not found.
at freemarker.template.Configuration.getTemplate(Configuration.java:450)
at freemarker.template.Environment.include(Environment.java:963)
at freemarker.template.Include.accept(Include.java:153)
... 34 more


Please help me... Its urgent :(


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