Hibernate version: 3.2.1.ga
Database: MySQL - innodb 5.x
Following the Hibernate examples, wasNull below should tell me if the value from the database for this column is null.
public Object nullSafeGet(...) throws SQLException {
if (resultsSet.wasNull()) return null;
....
}
However, in my example at least, the test is for the WRONG column, the previous and not the current one.
The caller of nullSafeGet is hydrate at line 2046, from the class org.hibernate.persister.entity.AbstractEntityPersister
public Object[] hydrate(...) {
...
values[i] = types[i].hydrate( propertyResultSet, cols, session, object );
}
Hydrate looks at the types array which relates to the types of the EntityMetamodel for the target, and passes the resultset to the nullSafeGet along with the column name for the UserType in cols[0]. However, I notice that the types and columns arrays differs to the resultSet in number of columns since the resultSet contains an index for the identifier of the record at the start of its collection, but the others do not. As such the indexes are mis-aligned. I have not studied further up the chain from hydrate, but it seems that this could be the culprit of wasNull referring to a different (previos) value?
The mapping file does nothing complicated - the only relevant bit is the start:
<id name="id" column="id" type="long" unsaved-value="null">
<generator class="identity"/>
</id>
<version name="version" column="version"/>
<property name="usersId"/>
Does this look right, or am I completely missing something here?
adam
|