-->
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: changing annotations generated by reverse engineering tool
PostPosted: Tue Feb 22, 2011 6:43 am 
Newbie

Joined: Tue Feb 22, 2011 6:17 am
Posts: 2
Hello All,

we have a specific requirement that while generating pojo's (ejb3) from oracle data base for the Date(oracle) to Date(java) we receive following annotations.

@Temporal(TemporalType.DATE)
@Column(name = "STATE_CHANGE_DATE_TM", nullable = false, length = 7)
public Date getStateChangeDateTm() {
return this.stateChangeDateTm;
}

instead we want it to be generated as

@Temporal(TemporalType.TIMESTAMP)
@Column(name = "STATE_CHANGE_DATE_TM", nullable = false, length = 7)
public Date getStateChangeDateTm() {
return this.stateChangeDateTm;
}


Top
 Profile  
 
 Post subject: Re: changing annotations generated by reverse engineering tool
PostPosted: Wed Feb 23, 2011 4:46 am 
Newbie

Joined: Tue Feb 22, 2011 6:17 am
Posts: 2
Thanks All,


After some dig into the hibernate tool code I was able to find the solution for my problem.

I changed the "Ejb3PropertyGetAnnotation.ftl" file as given below


original
<<
<#elseif c2h.isCollection(property)>
${pojo.generateCollectionAnnotation(property, cfg)}
<#else>
${pojo.generateBasicAnnotation(property)}
${pojo.generateAnnColumnAnnotation(property)}
</#if>
>>

Changed
<<<<<<<<
<#elseif c2h.isCollection(property)>
${pojo.generateCollectionAnnotation(property, cfg)}
<#elseif c2h.isTemporalValue(property)>
@Temporal(TemporalType.TIMESTAMP)

${pojo.generateAnnColumnAnnotation(property)}
<#else>
${pojo.generateBasicAnnotation(property)}
${pojo.generateAnnColumnAnnotation(property)}
</#if>
>>>>>>


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.