-->
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.  [ 4 posts ] 
Author Message
 Post subject: Boolean type and inserting null values
PostPosted: Wed Sep 14, 2005 9:40 pm 
Newbie

Joined: Wed Sep 14, 2005 9:33 pm
Posts: 2
I've searched high & low, but can't seem to find the answer on how to accomplish this:

We have a database column of type 'bit' that accepts null values (so it allows 3 values). We have the mapping setup w/ type "boolean":

Code:
        <property name="approved" type="integer">
            <column name="Approved" />
        </property>



The problem is that even if we explicitly set the property to null (since the class is storing the value as a java.lang.Boolean, this is allowed), Hibernate inserts a 0 (false). How can you override this functionality and allow 0, 1, and null to be inserted?

TIA.
Michael


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 9:43 pm 
Newbie

Joined: Wed Sep 14, 2005 9:33 pm
Posts: 2
Sorry, the mapping type is boolean, not integer:

Code:
        <property name="approved" type="boolean">
            <column name="Approved" />
        </property>



Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 10:22 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
you can do it with java boolean (java boolean have only true or false(, but you have try
with Boolean class - it have null value


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 10:25 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
Quote:
you can do it with java boolean


you can't do it with java boolean

sorry


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