Accessing id property of association within element collection in query leads to exception
Description
A query like from Entity e join e.elementCollection c where c.association.id is not null fails saying the property can't be found.
Activity
Show:
Christian BeikovSeptember 29, 2019 at 10:22 AM
@gbadner this also fixes the use of special names like e.g. “size“ in a query like {{select c.embeddable.size from Entity e join e.collection c}}. In versions below 5.4 such a query will fail with the following
Caused by: org.hibernate.QueryException: illegal syntax near collection: embeddable.size at org.hibernate.persister.collection.CollectionPropertyMapping.toType(CollectionPropertyMapping.java:51) at org.hibernate.hql.internal.ast.tree.FromElementType.getPropertyType(FromElementType.java:397) at org.hibernate.hql.internal.ast.tree.FromElement.getPropertyType(FromElement.java:515) at org.hibernate.hql.internal.ast.tree.DotNode.getDataType(DotNode.java:682)
I just wanted to mention that because I had the issue on the radar for a long time and I recently saw which I thought is the same, but isn’t.
A query like
from Entity e join e.elementCollection c where c.association.id is not null
fails saying the property can't be found.