-->
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.  [ 5 posts ] 
Author Message
 Post subject: Custom template PojoTypeDeclaration.vm
PostPosted: Thu Feb 01, 2007 7:47 am 
Beginner
Beginner

Joined: Tue Jan 30, 2007 1:35 pm
Posts: 27
Hi all,

I'm using the Hibernate Tools 3.2.0.beta8 in myeclipse. I try to use the pojo's template myeclipse_templates to generate the java class.

I customize the PojoTypeDeclaration.vm like this :

/**
$pojo.getClassJavaDoc($render.eval($ctx, "$pojo.getDeclarationName() generated by MyEclipse - Hibernate Tools"),0)
*/
$templates.Ejb3TypeDeclaration
$pojo.getClassModifiers() $pojo.getDeclarationType() $pojo.getDeclarationName() $pojo.getExtendsDeclaration() implements RulesEO

Is the custom file correct ?

In the hibernate code generation, I check on "Use Custom templates" and select the myeclipse template folder location (the parents folder that consist of pojo, hbm and dao folder.

my problem is when I generate the java class it didn't use the template.

Do I need to do some setting to enable the custom template in myeclipse ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 01, 2007 8:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
sorry, but I can't really help with myeclipse's version of the tooling.

I can tell you how it works in the real hibernte tools and here it would be freemarker and it should just work ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Eclipse Hibernet tools "Use custom template" not w
PostPosted: Thu Feb 01, 2007 9:14 am 
Beginner
Beginner

Joined: Tue Jan 30, 2007 1:35 pm
Posts: 27
I try to use Eclipse plugin's Hibernate tools this time, and check on "Use custom template". I use the PojoTypeDeclaration.ftl (I get from hibernet-tools.jar) and place it in the my project folder. e.g \<MyService>\templates. The following is my custom PojoTypeDeclaration.ftl file :

/**
${pojo.getClassJavaDoc(pojo.getDeclarationName() + " generated by hbm2java", 0)}
*/
<#include "Ejb3TypeDeclaration.ftl"/>
${pojo.getClassModifiers()} ${pojo.getDeclarationType()} ${pojo.getDeclarationName()} ${pojo.getExtendsDeclaration()} implements RulesEO

And still it will refer to the old template...to generate my java class....May I know how to enable the custome template ? Thanks for your advice.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 01, 2007 9:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if you point to <MyService>/templates the file should be named:

<MyService>/templates/pojo/PojoTypeDeclaration.ftl

notice the pojo directory name.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 01, 2007 9:56 am 
Beginner
Beginner

Joined: Tue Jan 30, 2007 1:35 pm
Posts: 27
Thanks a lot..It is working now ! Yes..hahaha !

The solution is :

1) creat the template folder e.g (C:\MyService).
2) if you wish to overide the PojoTypeDeclaration.ftl. Create a folder called pojo and put ur custom files inside. e.g :
=> C:\MyService\pojo\PojoTypeDeclaration.ftl
3) in the Hibernet tools ui, check on "Use custom templates", template directory: \MyService\ (note: dont put until pojo folder, it wont work !)......haha. good luck to all..hope it can help others...as well.


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