-->
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: Generation POJOs with annotations over properties
PostPosted: Wed Nov 18, 2009 11:57 am 
Newbie

Joined: Wed Nov 18, 2009 11:49 am
Posts: 2
Hi,

I produce POJOs with eclipse hibernate plug-in from my database. But it produces annotations over get* functions like;

@Id
@Column(name = "ID_PATIENT_CLASS", unique = true, nullable = false, precision = 10, scale = 0)
public long getIdPatientClass() {
return this.idPatientClass;
}

But I'd like to produce it over properties like;

@Id
@Column(name = "ID_PATIENT_CLASS", unique = true, nullable = false, precision = 10, scale = 0)
private long idPatientClass;

Is a way ( or a tutorial preferred :) ) to generete annotations over properties ? Thanks for all answers.


Top
 Profile  
 
 Post subject: Re: Generation POJOs with annotations over properties
PostPosted: Thu Nov 19, 2009 3:23 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
Though I am not 100% sure if this solution will work, I know that you can change the .ftl files in your hibernate tools jar file to make changes to the way the java class files are generated. I had used it for making changes to the cascade property being applied to the relationships.
You can check my thread for manipulating the cascade attribute here
https://forum.hibernate.org/viewtopic.php?f=6&t=985004
Hibernate-tools.jar/pojo/Ejb3PropertyGetAnnotation.ftl should be a fine place to start looking at.

HTH

_________________
Sukirtha


Top
 Profile  
 
 Post subject: Re: Generation POJOs with annotations over properties
PostPosted: Sun Dec 13, 2009 11:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you dont need to change the ftl files in the tools.jar, just copy the .ftl files you want to change to a directory and put it on the template-path which will then be picked up before the tools.jar templates.

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