No way to get Object's type in nullSafeGet

Description

I am trying to do the following:

public class SerUserType extends MutableUserType {
protected Class klass;
protected SerA ser=F.g(SerA.class);
public Class returnedClass() {
return klass;
}
public int[] sqlTypes() {
return new int[] {Types.BLOB};
}
public boolean equals(Object x, Object y) throws HibernateException {
return ObjectUtils.equals(x, y);
}
public Object deepCopy(Object value) {
klass=value.getClass();
Copyable copyable=(Copyable)value;
Object copy=copyable.copy();
return copy;
}
public Object nullSafeGet(ResultSet resultSet,String[] names,SessionImplementor session,Object owner)
throws HibernateException,SQLException {
byte[] b=(byte[])BlobType.INSTANCE.nullSafeGet(resultSet,names,session,owner);
return ser.deser(b,klass);
}
public void nullSafeSet(PreparedStatement preparedStatement,Object value,int index,SessionImplementor session)
throws HibernateException,SQLException {
BlobType.INSTANCE.nullSafeSet(preparedStatement,ser.ser(value),index,session);
}
}

However, this is not possible because it is not possible to access the object's class in the nullSafeGet method. I propse that the object's class is passed to the nullSafeGet in the UserType interface.

Regardless of whether is correct in functionality (I haven't tested), I think it would be highly beneficial to know the runtime class of the object in the nullSafeGet metod.

Environment

None

Assignee

Unassigned

Reporter

Vagif Kuliyev

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure