[b]Hibernate version:2.1.7[/b]
[b]Name and version of the database you are using:Oracle 9[/b]
In case of coding a UserType "Hibernate in Action" proposes a immediate resultSet.wasNull() check on entry of UserType.nullSafeGet.
It would look like
[code]
public Object nullSafeGet(ResultSet inRSet, String[] inNames, Object inOwner) throws HibernateException,
SQLException {
if (inRSet.wasNull()) {
return null;
}
[/code]
This fails whenever you have a Select with a projection of only one column which is mapped to the user type, like
[code]
Select usertype-column from BLA bla where bla.id like ?")
[/code]
Obviously there wasn't any read to the ResultSet before entering the nullSafeGet Method. In this case wasNull() must throw en exception according to it's JavaDoc.
Conclusion: Don't use Method entry check as proposed.
|