-->
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: Custom Templates - not working
PostPosted: Mon Jul 16, 2007 7:57 pm 
Beginner
Beginner

Joined: Mon Jul 09, 2007 2:21 pm
Posts: 24
I am trying the hibernate code generation using the UI (not through ant task) and clicked on hibernate code generation from eclipse menu and checked "Use Custom Templates" option. then i specified the Template Directory as "\MyProject\config" where i have stored all ftl templates (i have modified some of them for my requirements)

After i run the code generation none of the changes i made to the template are there in the generated code.

for example in pojo.ftl, i added copyright information as follows... But in the generated code i dont see this data...

Do i have to include the directory containing the templates in the classpath or something.

Please help.

/**
*
* Copyright (c) 2007, XXX
* All Rights Reserved.
*
*/
${pojo.getPackageDeclaration()}

// Generated by Hibernate Tools ${version}

<#assign classbody>
<#include "PojoTypeDeclaration.ftl"/> {

<#if !pojo.isInterface()>

<#include "PojoFields.ftl"/>

<#include "PojoConstructors.ftl"/>

<#include "PojoPropertyAccessors.ftl"/>

<#include "PojoToString.ftl"/>

<#include "PojoEqualsHashcode.ftl"/>

<#else>
<#include "PojoInterfacePropertyAccessors.ftl"/>

</#if>
<#include "PojoExtraClassCode.ftl"/>

}
</#assign>

${pojo.generateImports()}
${classbody}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 23, 2007 6:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the files should be placed like this (for pojo/hbm2java generation):

<templatepath>/pojo/*.ftl

which in your case is /MyProject/config/pojo/*.ftl

_________________
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.  [ 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.