-->
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: String property with added functionality
PostPosted: Wed Jul 25, 2007 5:20 am 
Newbie

Joined: Fri Oct 06, 2006 1:25 pm
Posts: 5
Hibernate version: 1.0.2
Sql Server 200

Hi,

I create a string property in my class
private string _FormulaRange = "";
public string FormulaRange
{
get { return _FormulaRange; }
set { _FormulaRange = value; }
}
and in my hbm.xml file
<property name="FormulaRange">
<column name="FORM_SEUIL" sql-type="varchar" length="200" not-null="false" />
</property>

I'd like to add methods to my string property to analyse its value.
I'd like create a new public class Formula with for example a public GetXXXX method, and to write ma property like that :
private Formula _FormulaRange = new Formula();
public Formula FormulaRange
{
get { return _FormulaRange; }
set { _FormulaRange = value; }
}

THe formula value is always a string type and its value is saved in database.

Perhaps somebody can explain me how I can do this?
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 25, 2007 5:49 am 
Beginner
Beginner

Joined: Wed Oct 04, 2006 8:57 am
Posts: 25
You need to create a user type.

This thread http://forum.hibernate.org/viewtopic.php?t=977835 details how to do this for an XmlDocument.
Just replace XmlDocument with your class and you should be good to go.


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.