-->
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.  [ 2 posts ] 
Author Message
 Post subject: NULL values in Boolean field
PostPosted: Wed May 17, 2006 12:12 pm 
Newbie

Joined: Fri May 12, 2006 2:29 am
Posts: 3
Hi,

I accidentally posted this query on NHibernate Users group! Apologies for that.

I have a java class, with a member called "nativeFlag", which is of type java.lang.Boolean. (which means that it's nullable). In the mapping file, I haven't explicitly mentioned any type for nativeFlag.

When my table is created, the "nativeFlag" field is stored as a "tinyint" column in my Sybase DB.

Now, when the value in nativeFlag is NULL, I want NULL to be inserted in my DB. However, always 0 gets inserted.

How do I insert NULL in the table, if "nativeFlag" is null?

Need help on this.

Thanks in advance :-)
Harish.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 17, 2006 12:17 pm 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
You should probably define your own UserType. You could extend Hibernate's implementation for Boolean and provide support for a third value (null) in addition to true/false.
Check the wiki for examples.


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