micronaut-data icon indicating copy to clipboard operation
micronaut-data copied to clipboard

HQL `where in :entityList` when entityList is empty, fails with NPE

Open rawilder opened this issue 6 months ago • 1 comments

Expected Behavior

The HQL select entityA a where a.entityB in :listOfEntityBs with an empty list does not throw an NPE.

Actual Behaviour

Since 4.1, it seems that if an emptyList is passed into the repository function, it will throw an NPE down in the Hibernate code when Hibernate tries to derive the argument type by using value.getClass()

Steps To Reproduce

  1. Pull my branch (issue-3045) at https://github.com/rawilder/micronaut-data/tree/issue-3045
  2. Run the test: AbstractHibernateQuerySpec::"test where in empty list of entities"
  3. Observe NPE

Environment Information

  • MacOS
  • jdk 17 corretto
  • micronaut data 4.8.x

Example Application

https://github.com/rawilder/micronaut-data/blob/issue-3045/data-hibernate-jpa/src/test/groovy/io/micronaut/data/hibernate/AbstractHibernateQuerySpec.groovy#L74

Version

4.8.x

rawilder avatar Aug 01 '24 03:08 rawilder