-->
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.  [ 7 posts ] 
Author Message
 Post subject: hibernate tools ftl getJavaTypeName invocationTargetExceptio
PostPosted: Wed Apr 26, 2006 11:28 am 
Newbie

Joined: Wed Apr 26, 2006 11:17 am
Posts: 1
I'm using hbmtemplate with daohome.ftl and i'm getting an exception being thrown from this line:

public ${declarationName} findById( ${c2j.getJavaTypeName(clazz.identifierProperty, jdk5)} id) {


it seems to me like clazz.identifierProperty is coming back as generic object instead of Property, anyone know why this might happen? thanks in advance for the help!!

this is the exception:

[hibernatetool] No signature of method getJavaTypeName matches (java.lang.Object
,java.lang.Boolean)
[hibernatetool] The problematic instruction:
[hibernatetool] ----------
[hibernatetool] ==> ${c2j.getJavaTypeName(clazz.identifierProperty, jdk5)} [on l
ine 144, column 41 in DAO.ftl]
[hibernatetool] ----------

[hibernatetool] Java backtrace for programmers:
[hibernatetool] ----------
[hibernatetool] freemarker.template.TemplateModelException: No signature of meth
od getJavaTypeName matches (java.lang.Object,java.lang.Boolean)
[hibernatetool] at freemarker.ext.beans.MethodMap.getMostSpecific(Method
Map.java:191)
[hibernatetool] at freemarker.ext.beans.OverloadedMethodModel.exec(Overl
oadedMethodModel.java:105)
[hibernatetool] at freemarker.core.MethodCall._getAsTemplateModel(Method
Call.java:93)
[hibernatetool] at freemarker.core.Expression.getAsTemplateModel(Express
ion.java:89)
[hibernatetool] at freemarker.core.Expression.getStringValue(Expression.
java:93)
[hibernatetool] at freemarker.core.DollarVariable.accept(DollarVariable.
java:76)
[hibernatetool] at freemarker.core.Environment.visit(Environment.java:19
6)
[hibernatetool] at freemarker.core.MixedContent.accept(MixedContent.java
:92)
[hibernatetool] at freemarker.core.Environment.visit(Environment.java:19
6)
[hibernatetool] at freemarker.core.IfBlock.accept(IfBlock.java:82)
[hibernatetool] at freemarker.core.Environment.visit(Environment.java:19
6)
[hibernatetool] at freemarker.core.MixedContent.accept(MixedContent.java
:92)
[hibernatetool] at freemarker.core.Environment.visit(Environment.java:19
6)
[hibernatetool] at freemarker.core.Environment.visit(Environment.java:23
3)
[hibernatetool] at freemarker.core.BlockAssignment.accept(BlockAssignmen
t.java:83)
[hibernatetool] at freemarker.core.Environment.visit(Environment.java:19
6)
[hibernatetool] at freemarker.core.MixedContent.accept(MixedContent.java
:92)
[hibernatetool] at freemarker.core.Environment.visit(Environment.java:19
6)
[hibernatetool] at freemarker.core.Environment.process(Environment.java:
176)
[hibernatetool] at freemarker.template.Template.process(Template.java:23
1)
[hibernatetool] at org.hibernate.tool.hbm2x.TemplateHelper.processTempla
te(TemplateHelper.java:243)
[hibernatetool] at org.hibernate.tool.hbm2x.TemplateProducer.produceToSt
ring(TemplateProducer.java:67)
[hibernatetool] at org.hibernate.tool.hbm2x.TemplateProducer.produce(Tem
plateProducer.java:28)
[hibernatetool] at org.hibernate.tool.hbm2x.TemplateProducer.produce(Tem
plateProducer.java:97)
[hibernatetool] at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(G
enericExporter.java:112)
[hibernatetool] at org.hibernate.tool.hbm2x.GenericExporter.exportCompon
ent(GenericExporter.java:97)
[hibernatetool] at org.hibernate.tool.hbm2x.GenericExporter.exportClasse
s(GenericExporter.java:91)
[hibernatetool] at org.hibernate.tool.hbm2x.GenericExporter.doStart(Gene
ricExporter.java:69)
[hibernatetool] at org.hibernate.tool.hbm2x.AbstractExporter.start(Abstr
actExporter.java:93)
[hibernatetool] at org.hibernate.tool.hbm2x.GenericExporter.start(Generi
cExporter.java:59)
[hibernatetool] at org.hibernate.tool.ant.ExporterTask.execute(ExporterT
ask.java:40)
[hibernatetool] at org.hibernate.tool.ant.HibernateToolTask.execute(Hibe
rnateToolTask.java:160)
[hibernatetool] at org.apache.tools.ant.UnknownElement.execute(UnknownEl
ement.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.executeTarget(Project.ja
va:1214)
[hibernatetool] at org.apache.tools.ant.Project.executeTargets(Project.j
ava:1062)
[hibernatetool] at org.apache.tools.ant.Main.runBuild(Main.java:673)
[hibernatetool] at org.apache.tools.ant.Main.startAnt(Main.java:188)
[hibernatetool] at org.apache.tools.ant.launch.Launcher.run(Launcher.jav
a:196)
[hibernatetool] at org.apache.tools.ant.launch.Launcher.main(Launcher.ja
va:55)
[hibernatetool] An exception occurred while running exporter #4:generic exporter

[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.tool.hbm2x.ExporterException: Error while processi
ng template DAO
[hibernatetool] freemarker.template.TemplateModelException: No signature of meth
od getJavaTypeName matches (java.lang.Object,java.lang.Boolean)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 27, 2006 4:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what kind of mappings are you running this on ?

can you try and isolate it down to the mapped class that causes the problem ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Similar issue...success, but build fails?
PostPosted: Mon May 08, 2006 6:14 pm 
Newbie

Joined: Mon May 08, 2006 6:02 pm
Posts: 3
Location: Michigan
I am getting a similar stack trace when generating DAOs for my schema. The schema consists of 54 classes, some have composite keys. When running a custom <hbmtemplate> from ant, it seems that my 54 DAOs are generated, but the task fails while attempting to generate a DAO for a primary key class. Below is a snippet from my build file and a snippet from my ant logging. Notice the "TemplateHelper.putInContex" log entries immediately following the last successfully-generated DAO.

From build.xml:
Code:
   <target name="genAll" depends="init">
      <delete includeemptydirs="true">
         <fileset dir="${gen.source.dir}" includes="**/*"/>
      </delete>
      <hibernatetool destdir="${gen.source.dir}">
         <jdbcconfiguration
            configurationfile="${hibernate.cfg.xml}"
            packagename="${dao.package.name}"
            revengfile="${hibernate.reveng.xml}"/>
         <hbm2hbmxml/>
         <hbm2java jdk5="${jdk5.flag}" ejb3="${ejb3.flag}"/>
         <hbmtemplate filepattern="{package-name}/{class-name}DAO.java"
            templatepath="${dao.template.path}"
            template="${dao.template}">
            <property key="jdk5" value="${jdk5.flag}" />
            <property key="ejb3" value="${ejb3.flag}" />
         </hbmtemplate>
      </hibernatetool>
   </target>


From the log:

Code:
[hibernatetool] 2006-05-08 17:48:49,377 INFO  TemplateProducer.produce - Writing onstarDAO to D:\workspaces\workshop\dataservices\gen_src\com\onstar\dataservices\model\DacsiDAO.java
[hibernatetool] 2006-05-08 17:48:49,387 DEBUG TemplateHelper.putInContext - putInContext pojo=org.hibernate.tool.hbm2x.pojo.ComponentPOJOClass(com.onstar.dataservices.mod
el.VehiclealertconfigurationId)
[hibernatetool] 2006-05-08 17:48:49,387 DEBUG TemplateHelper.putInContext - putInContext clazz=org.hibernate.mapping.Component([org.hibernate.mapping.Property(dtcstatusmask), org.hibernate.mapping.Property(vehicleid)])
[hibernatetool] 2006-05-08 17:48:49,387 DEBUG Log4JLoggerFactory$Log4JLogger.debug - onstarDAO.ftl[en_US,Cp1252,parsed] cached copy not yet stale; using cached.
[hibernatetool] 2006-05-08 17:48:49,387 DEBUG Log4JLoggerFactory$Log4JLogger.debug - Key 'entityName' was not found on instance of org.hibernate.mapping.Component.
... <snipping lots of class introspection output>
[hibernatetool] 2006-05-08 17:48:49,397 ERROR Log4JLoggerFactory$Log4JLogger.error -
[hibernatetool] Expression clazz.entityName is undefined on line 150, column 34 in onstarDAO.ftl.
[hibernatetool] The problematic instruction:
[hibernatetool] ----------
[hibernatetool] ==> ${clazz.entityName} [on line 150, column 32 in onstarDAO.ftl]
[hibernatetool] ----------
[hibernatetool] Java backtrace for programmers:
[hibernatetool] ----------
[hibernatetool] freemarker.core.InvalidReferenceException: Expression clazz.entityName is undefined on line 150, column 34 in onstarDAO.ftl.

Thanks,
Scott


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 08, 2006 6:24 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
an what is onstarDAO.ftl ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 08, 2006 6:27 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
aaah since you are using hbmtemplate it will also process components.

you should add some check in top that calls isComponent() (As far as i remember) and simply generates an empty file - then it will not be saved.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 09, 2006 6:25 pm 
Newbie

Joined: Tue May 09, 2006 8:41 am
Posts: 1
max wrote:
aaah since you are using hbmtemplate it will also process components.

you should add some check in top that calls isComponent() (As far as i remember) and simply generates an empty file - then it will not be saved.


I have a similar problem (but trying to replicate the generation of the mapping files from database objects)
However isComponent() on its own cannot be found - what object does it apply to ?
Alternatively is there an example ant task that uses hbmtemplate to replicate hbm2hbmxml as that will show me enough to work from

Thanks
Mark


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 10, 2006 8:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
$pojo.isComponent()

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