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.

Would be great if this could be backported to 5.3

Fixed

Details

Assignee

Reporter

Components

Fix versions

Priority

Created October 18, 2018 at 9:33 AM
Updated September 29, 2019 at 10:22 AM
Resolved November 2, 2018 at 6:18 PM