I’m encountering an issue, and I’m using the following as a test example. The subquery is expected to return a full Person
entity, but instead, it’s only returning the ID. Here’s a simplified version of the query:
TypedQuery<Object> query = entityManager.createQuery("SELECT pe, (SELECT pe1 FROM Person pe1 WHERE pe1.nm = pe.nm AND pe1.active = true) " +
“FROM Person pe”, Object.class);
In the result, the subquery (pe1
) only includes the ID
instead of the full Person
object. This used to work as expected in Hibernate 4.3, where the subquery returned the complete object. Any ideas on what might be causing this behavior in the current version?