-->
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: DB mapping to Java boolean?
PostPosted: Tue Dec 09, 2003 5:32 am 
Newbie

Joined: Tue Dec 09, 2003 5:15 am
Posts: 3
Hi,

I have a table where boolean values are represented as VARCHAR (Oracle) fields with "1" for true and "2" for false. How can I map these fields to Java booleans?

I'm pretty new to Hibernate. Please be patient with me if this is a simple question :)

Thanks in advance,

Jeff


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2003 5:49 am 
Beginner
Beginner

Joined: Fri Nov 28, 2003 6:57 am
Posts: 20
Take a look at UserTypes. Examples are shipped with the distribution.

HTH,

Thorsten


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2003 7:11 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 8:07 pm
Posts: 229
Location: Brisbane, Australia
If you don't absolutely need to tha values to '1'/'2', you can map Booleans with a Hibernate.TRUE_FALSE, which gives 'T'/'F' in the column. I'm not sure if there's any simple customization you can do to get '1'/'2' instead of 'T'/'F'. Otherwise, yeah, a UserType or CompositeUserType are pretty easy to do anyway.

_________________
Cheers,
Shorn.


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.