-->
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: how to truncate value object in hbm.xml file
PostPosted: Fri Mar 30, 2007 8:59 am 
Newbie

Joined: Tue Feb 27, 2007 9:18 am
Posts: 7
Hi ,

<property name="parameterValue" type="string" length="100" column="SMPAR_VALUE"/>

parameterValue having string object of 100 characters, it may having data or not. while retriving data from hbm.xml mapping, is there any way of truncate the value for eleminating blank spaces??


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 30, 2007 12:25 pm 
Newbie

Joined: Fri Mar 30, 2007 8:19 am
Posts: 6
I've read your post several times but I'm not sure to understand what you mean.

I't seems you want to eliminate blank spaces from the begining and the end of your string. You have a function to do that in the Java API, trim().

If what you want is to access to the string directly and don't know where to put the function call, mind that hibernate works through reflection and access your properies using setters and getters, so, instead of the classical:

void setProperty(String property) {
this.property = property;
}

String getProperty() {
return(this.property);
}

you can use:

void setProperty(String property) {
this.property=property.trim();
}

String getProperty() {
return(this.property.trim();
}

Don't know if that was what you was looking for. Hope it helps.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 02, 2007 12:54 am 
Newbie

Joined: Tue Feb 27, 2007 9:18 am
Posts: 7
Hi ,
i would like to trim object value in XML file level.
if it is java bean level it is very easy. but when ever we need to take that value in differnt places, always add trim statements to the java code.
is there any possible way to trim in hbm.xml file level.

thanks


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.