| Some misunderstanding happened in the parent task. Reporter wrote in description that exception happens in
org.hibernate.persister.entity.DiscriminatorType.nullSafeSet(PreparedStatement, Object, int, SessionImplementor)
method, but it called only when binding parameter to TYPE() expression. I have the same issue when trying to write a query with optional parameters, e.g.:
SELECT p FROM Person p WHERE (:personType IS NULL OR TYPE(p) = :personType)
So the test case attached to the parent task is incorrect, see the attached modified test case to verify. Exception happens because of this row in the org.hibernate.persister.entity.DiscriminatorType.nullSafeSet(PreparedStatement, Object, int, SessionImplementor) method:
String entityName = session.getFactory().getClassMetadata((Class) value).getEntityName();
When value is null getClassMetadata() throws NullPointerException. |