-->
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: c2h undefined when using ant
PostPosted: Wed Jan 05, 2011 4:56 pm 
Newbie

Joined: Wed Jan 05, 2011 4:51 pm
Posts: 3
When I run hbm2java or hbmtemplate in ant, I get an error saying
[hibernatetool] freemarker.core.InvalidReferenceException: Expression c2h.isOneToOne is undefined on line 10, column 6 in pojo/Ejb3PropertyGetAnnotation.ftl.

As far as I can find, this problem was addressed exactly once before, here
http://community.jboss.org/message/326201#326201

The original poster claims that fixing the dependency did it, but I am absolutely sure that is not the cause of the problem for me.

Code:
<taskdef name="hibernatetool"
            classname="org.hibernate.tool.ant.HibernateToolTask"
            classpathref="toolslib"   />
<hibernatetool
      destdir="src/main/java/" >
      <jdbcconfiguration
           configurationfile="src/main/resources/hibernate.cfg.xml"
          revengfile="generate/reveng.xml"
           packagename="com.yoshi.persistence.dao"    />
      
      <hbm2java
         templatepath="generate/hibernate-tools-flt"
         jdk5="true"
         ejb3="true" />

<hbmtemplate
         exporterclass="org.hibernate.tool.hbm2x.POJOExporter"
         templatepath="generate/hibernate-tools-flt/pojo"
         template="Pojo.ftl"
         filepattern="{package-name}/{class-name}.java">
         <property key="jdk5" value="true"/>
         <property key="ejb3" value="true"/>
      </hbmtemplate>


Also, Ejb3PropertyGetAnnotation.ftl works completely fine when using the eclipse plugin.

Can anyone point out some potential causes?

On the other hand, the c2j does not cause any error. For example, running hbmtemplate with the default dao.ftl finishes fine.

I see that AbstractExporter.setupContext() puts in the context both "c2h" and "c2j". Am I looking at the right place?

Thank you!


Top
 Profile  
 
 Post subject: Re: c2h undefined when using ant
PostPosted: Thu Jan 06, 2011 4:44 pm 
Newbie

Joined: Wed Jan 05, 2011 4:51 pm
Posts: 3
It's because isOneToOne doesn't exist for org.hibernate.tool.hbm2x.Cfg2HbmTool, at least in the newest version, 3.2.3.GA. The Ejb3PropertyGetAnnotation.ftl in this version contains this:

Code:
<#if c2h.isManyToOne(property)>
<#--TODO support @OneToOne true and false-->   
${pojo.generateManyToOneAnnotation(property)}
<#--TODO support optional and targetEntity-->   
${pojo.generateJoinColumnsAnnotation(property, cfg)}
<#elseif c2h.isCollection(property)>
${pojo.generateCollectionAnnotation(property, cfg)}
<#else>
${pojo.generateBasicAnnotation(property)}
${pojo.generateAnnColumnAnnotation(property)}
</#if>
</#if>


Looking forward to that support!


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.