-->
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.  [ 5 posts ] 
Author Message
 Post subject: Easy way to make strings always uppercase?
PostPosted: Tue Nov 30, 2004 9:52 pm 
Newbie

Joined: Tue Sep 21, 2004 12:39 pm
Posts: 18
My customer would like to store all strings in uppercase, of course I can do this from the UI and/or BO tier, but is there a way in hibernate to parse string automatically to uppercase? Similar to that of the SQL formula that you can use to compute dynamic field values.

TIA

_________________
David Launen


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 01, 2004 3:39 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
you could implement your own UserType ...

gtx
curio


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 01, 2004 12:12 pm 
Beginner
Beginner

Joined: Tue Aug 26, 2003 2:46 pm
Posts: 45
Location: Saskatoon SK Canada
curio wrote:
you could implement your own UserType ...


I've wondered about something similar, and haven't used Hibernate enough to be sure: Is there any reason you couldn't just do a .toUpperCase in the set* method(s) of the class being persisted?

i.e.


Code:
public void setProperty (String property) {
  this.property = property.toUpperCase();
}

_________________
Maury


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 01, 2004 7:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
No reason why not - also take you no time just to try it.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 02, 2004 2:00 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
sure you can just use "toUpperCase" ... that depends on what are your needs ... if your customer wants the Strings persisted in upperCase but displayed for example in lowerCase then your approach won't do it ...
but, if that isn't the case ....

like david said ... give it a try ...

gtx
curio


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.