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.

Environment

None

Activity

Show:
Christian Beikov
September 29, 2019, 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

Assignee

Christian Beikov

Reporter

Christian Beikov

Fix versions

Labels

None

backPortable

Backport?

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure