-->
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: Hibernate 4 Upgrade and null in primitive boolean
PostPosted: Tue Mar 12, 2013 9:36 am 
Newbie

Joined: Fri Jan 18, 2013 4:45 am
Posts: 5
I am seeing the following error when trying to insert a null in to boolean.
Code:
[SQLServer JDBC Driver]The specified SQL type is not supported by this driver.

Database is SQLServer and the specific column is set to be nullable.

Now, i have seen a lot of threads on the web that null is not supported for primitive datatypes.
But this was working with Hibernate 3.5.2. I started getting this error after i tried to upgrade to 4.1.10.

Does anybody know if something changed in or after 3.6 that might have caused this.


Top
 Profile  
 
 Post subject: Re: Hibernate 4 Upgrade and null in primitive boolean
PostPosted: Tue Sep 24, 2013 4:26 am 
Newbie

Joined: Fri Jan 18, 2013 4:45 am
Posts: 5
Gave this another shot yesterday and i found something.

The change done to org.hibernate.type.BooleanType in the commit
https://github.com/hibernate/hibernate-orm/commit/d8fd8cd03b94c128c6110b34c96bb4c6effbc2b0#diff-1
seems to be the cause of this.
Hibernate 4.0 changed the sqltype for Boolean to Types.BOOLEAN which was Types.BIT earlier.

The bug
https://hibernate.atlassian.net/browse/HHH-6935
is also related and it was fixed for MySQL.

I am using SQLServer and it fails when trying to insert null.
I changed the SQLTypeDescriptor of BooleanType to BitTypeDescriptor and that solved the problem.

Now that makes me think about the type overriding that Hibernate 4 has introduced.
So what is the following line for in SQLServerDialect.java
registerColumnType( Types.BOOLEAN, "bit" );

If that's not for overriding, then is the function getSqlTypeDescriptorOverride supposed to do the overriding from Types.BOOLEAN to TYPES.BIT ?
Looks like a bug to me.
Any Hibernate geeks ?


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.