-->
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: Where is pojo entity that is used in templates?
PostPosted: Fri Jan 29, 2010 10:12 am 
Beginner
Beginner

Joined: Tue Jan 19, 2010 7:11 am
Posts: 23
Location: Spain
Hello again!!!

I would like to know if I can modify the pojo entity that is used in the templates.

I want modify the result of method pojo.generateBasicAnnotation(property) and pojo.generateAnnColumnAnnotation(property) and i add the annotations that i want....

And you say.... "you get the result and change it in the template".... but i want that hibernate read the database and generate my specific annotations, is it possible???

I don't use hbm.xml mapping files, i only use hibernate.reveng.xml, MyStrategy.java and hibernate templates....

Maybe my question is incorrect for my ignorance on the topic, if it is like that, sorry.

And thanks!!!!


Top
 Profile  
 
 Post subject: Re: Where is pojo entity that is used in templates?
PostPosted: Wed Feb 03, 2010 10:17 am 
Senior
Senior

Joined: Tue Aug 04, 2009 7:45 am
Posts: 124
You can create your helper class:
public class MyHelperClass {
public String generateBasicAnnotation(POJOClass pojo, Property prop){
return "hello";
}
}
Attach it as <property key="hibernatetool.helper.toolclass" value="x.y.z.MyHelperClass "/>\
and use it in custom templates as
${helper.generateBasicAnnotation(pojo,prop)}
to do the work.

Read this https://www.hibernate.org/hib_docs/tool ... bmtemplate


Top
 Profile  
 
 Post subject: Re: Where is pojo entity that is used in templates?
PostPosted: Tue Feb 09, 2010 7:16 am 
Beginner
Beginner

Joined: Tue Jan 19, 2010 7:11 am
Posts: 23
Location: Spain
Thank you Dmitry, you have helped me very much.


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.