Selecting EntityCollection fails ("not an entity")

Description

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:

Environment

Spring Boot 2.31. Final, Hibernate 5.4.17.FINAL, AdoptOpenJDK 11, Windows 10

Assignee

Unassigned

Reporter

Benjamin Maurer

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure