In a JPA query with single item select list, if a case expression with entity result is used, the result of query is a list of empty arrays instead of a list of objects. for example if I have an entity named PersonalActor and have 10 records of data in database, the following query return a list that its size equals 10 and its content is empty array.
select case when pa.name = 'a1' then pa else pa end from PersonalActor pa
the above query may seams somehow meaningless but note that it is just to show the problem.
test environment :
-
jdk 17
-
Hibernate 5.4.24.Final
-
JPA 2.1
to bring about the problem, a test case is created at GitHub - horakhsh/hibernate-test-case-templates: Templates and examples to report issues to Hibernate
thanks