MS SQL Server exception when setting fields of unlimited length to null using MS JDBC driver

Description

Hi,

I have a Stash add-on using ActiveObjects with entities that have string fields of unlimited length. Here's an example:

This all (for other databases) works fine, except for Microsoft SQL Server, where when I try to create an entity I get the following error:

When I try to execute a query (e.g., ao.find()) which uses this entity, I get the following error:

Is this a known bug?

Any help is much appreciated.

Thanks,
Michael

Environment

None

Testing Notes

Add notes...

Activity

Show:
Mibex Software
October 6, 2015, 8:25 AM

thanks for your feedback. I created a new issue for the other problem: https://ecosystem.atlassian.net/browse/AO-687

Renat Sabitov
October 6, 2015, 5:02 AM
Edited

This was introduced while fixing AO-468. Apparently, setting a value of generic NULL type to NTEXT column causes the driver to cast it as a VARBINARY NULL inside and then assignment fails.

Do you have a test case for AO-468? I reverted back to the original implementation of putNull and it works for NTEXT column. I want to be sure I won't cause a regression here.

Right, so MS SQL JDBC driver NULL has an UNKNOWN category and therefore is "unsupported", which causes NULL type to be overridden by BINARY:

Renat Sabitov
October 5, 2015, 9:59 PM

Confirming null causing the error, will investigate it further.

Please create another issue for the DISTINCT query, it's better to handle different problems separately.

Mibex Software
October 2, 2015, 9:03 AM
Edited

By the way, there is another issue with MS SQL server when executing the following statement:

which gets translated to

resulting in

Shouldn't the query get translated to

? Please note that this is not a count as in the example above!

I can create a new issue for this if you want me to.

Mibex Software
October 2, 2015, 8:58 AM

While trying to create a replicator, I was finally able to reproduce this issue. All that was necessary is to create an entity with an StringLength.UNLIMITED attribute and setting its value to null:

This is not an issue with other databases. Of course you would normally not explicitly set a value to null like this, but this piece of code is part of some generic handling for creating entities of this type where this value is often set to a specific value.

Fixed

Assignee

Renat Sabitov

Reporter

Mibex Software

Add-on Type

None

Team

None

CC

None

Risk factor

None

QA Kickoff Status

None

QA Demo Status

None

Story Points

2

Components

Sprint

None

Fix versions

Affects versions

Priority

Critical