-->
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: DB2 Boolean thoughts...
PostPosted: Tue Jul 18, 2006 11:18 pm 
Newbie

Joined: Tue Jul 18, 2006 11:08 pm
Posts: 1
Hi there. We love hibernate and are using it successfully on a lot of postgresql installs. We are currently testing against DB2 and are having issues with the fact that we use boolean/logical fields. DB2 seems to require us to use CHAR(1).

I have searched the forums for answers but none are forthcoming. These suggestions are out there:

1) Create a yes_no usertype. This would require a fair bit of code changing which we want to avoid plus, since it is handled java-side, I imagine it would not be all that performant.

2) Query substitution. set TRUE t, FALSE f. This doesn't seem to help with retrieving the data into an object. It works going out but not coming back.

I guess since hibernate has been so excellent jumping postgresql to oracle, we were hoping it would just plug and play with db2. Are there any other DB2 (and other Databases)/Hibernate users out there who could explain their cross-platform approach to this boolean thing?

Hope I don't annoy anyone, no harm intended.

ATB

Stuart Guthrie


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 19, 2006 4:15 pm 
Newbie

Joined: Fri Jun 30, 2006 5:30 pm
Posts: 13
You wouldn't have to create the yes_no user type, it already exists. It maps a boolean in an object to a 'Y' or 'N' on the database. We use this approach to go against both Oracle and DB2, there is no difference in our code or mapping files for either.

We didn't profile that exact type, but when we profiled our app which uses it, it certainly didn't stick out as a performance problem. Our User Defined types were a problem due to the resultSet.getXXX(String name) methods.

HTH


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 19, 2006 5:42 pm 
Newbie

Joined: Fri Oct 08, 2004 3:14 am
Posts: 10
Thanks for your help, we will try this today.


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.