Object owner in nullSafeGet() method UserType is always null

Hi. In hibernate 6 when i implement UserType i must implement method nullSafeGet. The last parameter of this method owner is always null
Click FindUsages on this method and we will see:

@Override
		public J extract(ResultSet rs, int paramIndex, WrapperOptions options) throws SQLException {
			final J extracted = userType.nullSafeGet( rs, paramIndex, options.getSession(), null );
			logExtracted( paramIndex, extracted );
			return extracted;
		}

IMHO if it should always be null then maybe better is remove this parameter because, it doesn’t give any information, it only confuses that it can be used like in version 5 of hibernate

You can create a JIRA ticket for this if you want. We are open to improvements, but since UserType is an API, any changes must be backwards compatible. To achieve that, we could add new method overloads for nullSafeGet and nullSafeSet with a default implementation that delegates to the existing methods which should also be deprecated. Removal of the old methods would only be possible in the next major version.

I create Jira [HHH-17114] - Hibernate JIRA

1 Like