[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-2135) Hibernate Deserialization: In org.hibernate.type.SerializableType the code makes a test for the return of a null object by simply testing the object as to whether or not it is null.
Steve Ebersole (JIRA)
noreply at atlassian.com
Thu Nov 2 14:01:04 EST 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2135?page=all ]
Steve Ebersole closed HHH-2135:
-------------------------------
Resolution: Fixed
applied on trunk and 3.2
> Hibernate Deserialization: In org.hibernate.type.SerializableType the code makes a test for the return of a null object by simply testing the object as to whether or not it is null.
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HHH-2135
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2135
> Project: Hibernate3
> Type: Improvement
> Versions: 3.2.0.cr5
> Environment: HIbernate 3.2.1 & NCR TeradataJBOss 4.0.x & JBoss Cache 1.2.4
> Reporter: Lamon Gray
> Assignee: Steve Ebersole
> Priority: Trivial
> Fix For: 3.2.1
>
>
> In org.hibernate.type.SerializableType the code makes a test for the return of a null object by simply testing the object as to whether or not it is null.
> public Object get(ResultSet rs, String name) throws HibernateException, SQLException {
> byte[] bytes = (byte[]) Hibernate.BINARY.get(rs, name);
> if ( bytes==null) {
> return null;
> }
> else {
> return fromBytes(bytes);
> }
> }
> Fairly reasonable, however in my testing of the Teradata dialect i am finding that often the value in the column is null but that the return is coming back as an empty array. The following code would seem to be a bit more robust in my opinion:
> public Object get(ResultSet rs, String name) throws HibernateException, SQLException {
> byte[] bytes = (byte[]) Hibernate.BINARY.get(rs, name);
> if ( bytes==null || Array.getLength(bytes)==0) {
> return null;
> }
> else {
> return fromBytes(bytes);
> }
> }
> Can someone tell me if this is done this way for a reason? Or maybe the JDBC driver is returning the incorrect value (IE. it should be returning a null value as opposed to an empty array)?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list