[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-5413) null values for columns mapped as "boolean" cause exception when saving entity with Sybase jdbc4

Strong Liu (JIRA) noreply at atlassian.com
Wed Nov 2 11:20:19 EDT 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5413?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Strong Liu resolved HHH-5413.
-----------------------------

       Resolution: Fixed
    Fix Version/s: 4.0.0.next
         Assignee: Strong Liu

I believe this is fixed by HHH-6795, at least jConnect4

> null values for columns mapped as "boolean" cause exception when saving entity with Sybase jdbc4
> ------------------------------------------------------------------------------------------------
>
>                 Key: HHH-5413
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5413
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.3, 3.5.4, 3.6.0.Beta1
>         Environment: Sybase jdbc4
>            Reporter: Strong Liu
>            Assignee: Strong Liu
>             Fix For: 4.0.0.next
>
>         Attachments: TestBoolean.tgz
>
>
> ASE doesn't allow 'null' value for 'BIT' datatype;
> While performing insert operation using jconn3.jar it permit you to have
> 'null' value, this 'null' value is converted into bit 0 by jconn3 & hence
> ASE doesn't throw any exception;
> But incase of jconn4.jar 'null' value is not converted into bit 0, hence
> jconn4 directly reports an exception for 'null' value(which is the expected
> correct behavior)
> Hibernate persists a null Boolean value by calling:
> PreparedStatement.setNull( index, java.sql.Types.BIT )
> The SQL code, java.sql.Types.BIT, is used because the Hibernate BooleanType defines its code as java.sql.Type.BIT.
> This can be reproduced using an annotations unit test, Java5FeaturesTest.testAutoboxing()..
> Sybase maps bit columns to tinyint, so when the unit test is executed, the column in the underlying table is actually of type tinyint, not bit. Sybase allows nullable tinyint columns, so there should be no problem persisting a null value as null.
> I've verified that changing the call to:
> PreparedStatement.setNull( index, java.sql.Types.TINYINT )
> persists the null value without being converted to 0.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list