NullPointerException when access data from query cache

Hi,

when i try execute query with null values in result i get NPE in JdbcValuesCacheHit.

The simplest example to reproduce:

session.createQuery("select null").setCacheable(true).list()



Caused by: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "row" is null
	at org.hibernate.sql.results.jdbc.internal.JdbcValuesCacheHit.getCurrentRowValue(JdbcValuesCacheHit.java:229) ~[hibernate-core-6.5.2.Final.jar:6.5.2.Final]
	at org.hibernate.sql.results.internal.RowProcessingStateStandardImpl.getJdbcValue(RowProcessingStateStandardImpl.java:120) ~[hibernate-core-6.5.2.Final.jar:6.5.2.Final]
	at org.hibernate.sql.results.graph.basic.BasicResultAssembler.extractRawValue(BasicResultAssembler.java:52) ~[hibernate-core-6.5.2.Final.jar:6.5.2.Final]

Looks like JdbcValuesCacheHit cannot process null value is query cache. Is this a defect in hibernate? I used hibernate 6.5.2 and infinispan 15 versions.

Please try to create a reproducer with our test case template and if you are able to reproduce the issue, create a bug ticket in our issue tracker and attach that reproducer.

done HHH-18439

1 Like