-->
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.  [ 4 posts ] 
Author Message
 Post subject: hbm2hbmxml with default-cascade?
PostPosted: Mon Jul 02, 2007 7:21 am 
Regular
Regular

Joined: Wed Nov 01, 2006 2:17 pm
Posts: 78
Hi,

I am searching for a way to tell the Ant task 'hbm2hbmxml' to insert 'default-cascade="save-update"' into all generated hbm.xml-files.

Can this be achieved easily or do I have to edit the ftl template?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 02, 2007 7:44 am 
Regular
Regular

Joined: Wed Nov 01, 2006 2:17 pm
Posts: 78
I extracted the hbm templates from hibernate-tools.jar but this approach does not work:

Code:
<hbmtemplate
                templateprefix=""
               filepattern="../entity/{class-name}.hbm.xml"
               templatepath="${templatepath}/hbm"
               template="hibernate-mapping.hbm.ftl">
               <property key="jdk5" value="true" />
               <property key="ejb3" value="false" />
            </hbmtemplate>


Code:
[hibernatetool] No signature of method getTag matches (org.hibernate.mapping.Component)
[hibernatetool] The problematic instruction:
[hibernatetool] ----------
[hibernatetool] ==> ${c2h.getTag(clazz)} [on line 1, column 2 in persistentclass.hbm.ftl]
[hibernatetool] in include "persistentclass.hbm.ftl" [on line 34, column 1 in hibernate-mapping.hbm.ftl]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 02, 2007 8:31 am 
Regular
Regular

Joined: Wed Nov 01, 2006 2:17 pm
Posts: 78
Ok, solved it. I had to check for "pojo.isComponent()" inside the template. If so ignore generating the file.


Top
 Profile  
 
 Post subject: Re: hbm2hbmxml with default-cascade?
PostPosted: Wed May 20, 2009 5:25 pm 
Beginner
Beginner

Joined: Tue Feb 03, 2009 4:33 pm
Posts: 21
Hi rapthor,

I'm trying to do the same thing here, but I don't really understand what you did to solve this problem. Did you end up modifying the hibernate-mapping.hbm.ftl file after all?

Is there some way I can set a property in the hbm2hbmxml task so that the ftl check "hmgs.hasNonDefaultCascade()" returns true?

I'm a little new to all this freeMarker / templating stuff, so I don't really understand where the "hmgs" gets populated...


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