-->
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: Inserting another interface into generated POJOs
PostPosted: Tue May 30, 2006 4:53 pm 
Newbie

Joined: Tue Apr 18, 2006 6:11 am
Posts: 11
Hi,

I generate pojos from db, so it is not really meaningful to use the annotation way of customizing generated pojos.

I only want to add "implements Serializable, XYZ" as declaration to all of the generated Pojo classes. As default "implements Serializable" is generated, so
it should only be a need to put the other interface after it.

What is the most convenience way to do this? Is it really a need to write a whole new template file?

cheers,

Gerald


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 4:52 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
currently yes. And hey, it is not that bad:

Write a pojo/PojoTypeDeclaration.ftl that is a copy of the one from the jar and change it to:
Code:
/**
${pojo.getClassJavaDoc(pojo.getDeclarationName() + " generated by hbm2java", 0)}
*/
<#include "Ejb3TypeDeclaration.ftl"/>
${pojo.getClassModifiers()} ${pojo.getDeclarationType()} ${pojo.getDeclarationName()} ${pojo.getExtendsDeclaration()} implements Serializable, XYZ

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 5:25 am 
Newbie

Joined: Tue Apr 18, 2006 6:11 am
Posts: 11
Many thanks Max. It works fine, and hey it's really that easy.

cheers,

Gerald


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.