-->
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: Map DB Column To Boolean
PostPosted: Thu May 05, 2005 5:53 pm 
Newbie

Joined: Thu May 05, 2005 5:49 pm
Posts: 11
Location: San Diego, California
I have several DB columns in an Oracle schema that are of type NUMBER(1). The contents of this column can be either "1" or "0" (i.e true|false or yes|no). Can I map these directly to a boolean type in my Java class via the *.hbm.xml file?

Thanks.

A.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 05, 2005 6:06 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
try filter objects (tables/views) with http://opensource.atlassian.com/project ... se/HBX-250

regards


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 05, 2005 6:11 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
i'm sorry.wrong tread
You have to use hibernate type (it is easy with hibernate3)


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 06, 2005 10:52 am 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
1 and 0 is the default behavior for the boolean type. Just make your properties boolean or Boolean (if you have tri-state behavior).

If you're silly like us then you would have to specifically set the type if you wanted to use something like Y/N. Or you could write your own type and map to Bob and Doug ;)


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 06, 2005 2:40 pm 
Regular
Regular

Joined: Mon Jul 26, 2004 2:28 pm
Posts: 86
Location: Pensacola, Florida
There are also the true_false and yes_no Hibernate types to support 'T'/'F' and 'Y'/'N' CHAR fields, respectively.

- Jesse


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.