Selecting an @ElementCollection property via JPQL fails with an exception:
throws: org.hibernate.QueryException: not an entity
Selecting a basic type or associated entity this way works as expected. Adding an explicit join fixes this:
This works. The explicit JOIN is not needed for basic types and associated entities.
I've attached a test case using the Github hibernate/hibernate-test-case-templates, because I had some Gradle error when trying to build hibernate-orm directly. Which is a pitty, bc. I think this test could just be added to the existing ElementCollection QueryTest using the existing 'EntityWithAnElementCollection.class'.
Update: I’ve created a new test case and created a pull-request.
Here is the complete Stack Trace for the test case:
Spring Boot 2.31. Final, Hibernate 5.4.17.FINAL, AdoptOpenJDK 11, Windows 10