-->
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: Custom code generation and templates
PostPosted: Fri Mar 10, 2006 6:39 pm 
Newbie

Joined: Fri Mar 10, 2006 6:32 pm
Posts: 3
I'm trying to figure out how to get Hibernate (hbm2java) to using custom code templates during code generation. I found where you can tell the Ant task to look for custom templates in a directory. However, I can't find any documentation on what those template files look like. How do I write one?

I'm hoping I can write a custom template to make the code generation produce fields with custom annotations on them, such as @SomeCustomAnnotationName(value). I'm doing this in hopes that I can get hbm2java to include annotations such as @MaxLength(x) where x is whatever appears in the length attribute of a property tag. Do you think this is possible?

I greatly appreciate any help I can get.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 10, 2006 7:05 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
look for pojo/Pojo.ftl in the hibernate-tools.jar for how the default ones look like.

(it is called pojo/Pojo.vm in the beta4 release because we used velocity there...in cvs we are using freemarker)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 14, 2006 12:57 pm 
Newbie

Joined: Fri Mar 10, 2006 6:32 pm
Posts: 3
Thanks for the info max.

Does what I'm trying to do sound possible/reasonable?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 14, 2006 1:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes

_________________
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.  [ 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.