-->
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.  [ 1 post ] 
Author Message
 Post subject: How to map a component via its constructor???
PostPosted: Tue May 13, 2008 5:24 pm 
Beginner
Beginner

Joined: Fri Jul 08, 2005 8:55 pm
Posts: 37
Hi,

Hibernate version: 3.2.x

Mapping documents:
...
Code:
<component name="allocationFraction" className="...Fraction">
   <property name="numerator" column="NUMERATOR" type="long"/>
   <property name="denominator" column="DENOMINATOR" type="long" />
</component>


fraction is:
Code:
class Fraction {
  private long numerator;
  private long denominator;
...
  public long getNumerator() { return numerator; }
  public void setNumerator(long num) { numerator = num; }
}


This class however is not immutable because the current hibernate mapping requires a setNumerator/setDenominator. These methods are not used anywhere BUT via Hibernate, I would like to get rid of them to avoid potential issues.

We have a constructor Fraction(numerator,denominator) but how could I ensure that it is called via the Hibernate mapping?

Suggestions most welcomed...

Thanks

Benoit
http://www.Appendium.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.