Hi , while checking the implementation of Object hydration I found following problem..
In ComponentType.hydrate() after getting the value from given resultset there is condition which checks if value is null and field is a Key field, return null , which is not correct in case of composite key.
If the field is part of composite key that should be handled seprately.
Follwoing is the code in ComponentType.hydrate() :
public Object hydrate(
final ResultSet rs,
final String[] names,
final SessionImplementor session,
final Object owner)
throws HibernateException, SQLException {
int begin = 0;
boolean notNull = false;
Object[] values = new Object[propertySpan];
for ( int i = 0; i < propertySpan; i++ ) {
int length = propertyTypes[i].getColumnSpan( session.getFactory() );
String[] range = ArrayHelper.slice( names, begin, length ); //cache this
Object val = propertyTypes[i].hydrate( rs, range, session, owner ); if ( val == null ) { if (isKey) return null; //different nullability rules for pk/fk }
else {
notNull = true;
}
values[i] = val;
begin += length;
}
return notNull ? values : null;
}
Highlighted code is causing problem in my code.. Can anyone sugegst ,wht should I do in this case .Is there any hooks so that I can put my own implementation there.
Thanks and Regards,
Prasoon
|