tracker issue : CF-3760484

select a category, or use search below
(searches all categories and all time range)
Title:

JDBC driver fails on updating entities with NULL bit fields in MSQL: specified SQL type is not supported by this driver.

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/Duplicate

Reporter/Name(from Bugbase): Samuel Knowlton / Samuel Knowlton (Samuel Knowlton)

Created: 05/14/2014

Components: Database

Versions: 11.0

Failure Type: Crash

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Critical / All users will encounter

Locale/System: ALL / Win 2012 Server x64

Vote Count: 0

Duplicate ID:	CF-3518916

Problem Description: When trying to update an entity inside a transaction, if the entity contains a

Steps to Reproduce:

Create an MS-SQL table as follows:

testID (uniqueidentifier, not null, default newID(), primary key)
bitfield (nullable, no default)
bitFieldNotNull (not nullable, default 0)
label (varchar (50), nullable)
counter (int, nullable)

Add two records: one with bitfield NULL and the label noBitField and one with bitfield 1 and the label hasBitField. Let bitFieldNotNull default to 0 and leave counter null.

Create a persistent CFC called Testme as follows:

component table="testme"  output="false" extends="inleague.model.ORM.Entity" schema="dbo" persistent="true" {
	property name="testID" column="testID" fieldtype="id" generator="guid" type="string" ormtype="string";
	property name="bitField" column="bitfield" type="boolean" ormtype="boolean";
	property name="bitFieldNotNull" column="bitFieldNotNull" ormtype="boolean" type="boolean";
	property name="label" column="label" ormtype="string" type="string";
	property name="counter" column="counter" ormtype="int" type="numeric";
}

("label" doesn't do anything but help me keep track of what's going on).

Run the following code:

<cfscript>
tests = EntityLoad("testme");
counter = 1;
transaction {
for (x in tests) {
	writedump(x);
	x.setCounter(1);
	EntitySave(x);
	counter++;
}
}
</cfscript>

Actual Result: Error: An exception occurred when committing the transaction. The root cause of this exception was: coldfusion.orm.hibernate.HibernateSessionException: [macromedia][SQLServer JDBC Driver]The specified SQL type is not supported by this driver.. 

Expected Result: Counter should be updated on the entity. A bit field that is nullable and whose value is NULL should not impact anything.

Any Workarounds: Stop using bit fields with NULL values? This works fine in CF9 and CF10.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3760484

External Customer Info:
External Company:  
External Customer Name: Aquitaine
External Customer Email:  
External Test Config: My Hardware and Environment details: CF 11 Standard (developer edition currently running in enterprise/trial mode) on Windows x64 and Microsoft SQL Server v11.0.3128 Standard

Attachments:

Comments:

Problem description should be 'if the entity in the database contains a nullable bit field, the JDBC driver will crash when trying to update it.'
Comment by External U.
12094 | May 14, 2014 02:28:24 PM GMT
http://helpx.adobe.com/coldfusion/release-note/coldfusion-11-release-notes.html CF-3518916 - Inserting Null for a primitive boolean type will throw an error in MS SQL Server. If you are using cfc for type mapping, use ormtype="numeric_boolean". If you are using hbmxml, use type="numeric_boolean".
Comment by Himavanth R.
12095 | May 15, 2014 12:34:12 AM GMT
So the solution is 'redo your ORM to accommodate a bug?' Do you intend to upgrade the version of Hibernate in CF11 to address this, or is this just something we are expected to live with? https://hibernate.atlassian.net/browse/HHH-6935
Comment by External U.
12096 | May 16, 2014 09:54:15 AM GMT