-->
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: Stop generated pojos properties starting in uppercase?
PostPosted: Wed Dec 01, 2010 2:46 pm 
Beginner
Beginner

Joined: Thu Mar 27, 2008 8:49 am
Posts: 27
I have run into a problem with a Flex client using the Spring BlazeDS framework. I believe the problem could be solved if my Hibernate pojo's have lower case property names but I am using hbm2java (so the hbm.xml files are autogenerated) and so don't seem to be able to control it. The generated pojo property looks like this:

Code:
private HTTracker HTTracker; // Has uppercase HT


and I need it to look like this:

Code:
private HTTracker htTracker; // Need lowercase initial letter(s)


but still have the getter and setter as (get/set)HTTracker or (get/set)HtTracker. I have a reveng.xml file but can't find any information on how to accomplish this.

The database table row is:

Code:
`tracker_id` INT NOT NULL ,
...
CONSTRAINT `fk_htUserTrackerDataMapper_tracker_id`
    FOREIGN KEY (`tracker_id` )
    REFERENCES `htTracker` (`tracker_id` )


Top
 Profile  
 
 Post subject: Re: Stop generated pojos properties starting in uppercase?
PostPosted: Sat Dec 04, 2010 10:17 am 
Beginner
Beginner

Joined: Thu Mar 27, 2008 8:49 am
Posts: 27
The answer is to use something like the following in the reveng.xml file:

Code:
<foreign-key constraint-name="fk_htUserTrackerDataMapper_tracker_id" >
    <many-to-one property="htTracker" />
    <set cascade="persist,merge,save-update" property="htUserTrackerDataMappers" />
</foreign-key>


It is the addition of the 'property' attribute that gets the job done.


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.