Christian Beikov (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYjZjNWE1MjA3...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-15648?atlOrigin=eyJpIjoiYjZjNW...
) HHH-15648 (
https://hibernate.atlassian.net/browse/HHH-15648?atlOrigin=eyJpIjoiYjZjNW...
) Fetching association and using implicit path in condition fails (
https://hibernate.atlassian.net/browse/HHH-15648?atlOrigin=eyJpIjoiYjZjNW...
)
Issue Type: Bug Affects Versions: 6.1.5 Assignee: Christian Beikov (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) Components: hibernate-core Created: 31/Oct/2022 08:05 AM Fix Versions: 6.1.6 Priority:
Major Reporter: Christian Beikov (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
A query like the following
CriteriaQuery<Customer> criteria = builder.createQuery( Customer.class );
Root<Customer> customerRoot = criteria.from( Customer.class );
customerRoot.fetch( "home" , JoinType.INNER );
criteria.where(
customerRoot.get( "home" ).in( em.getReference( Address.class, "abc"
) )
);
fails because the FK key part is used instead of the target part for the association
implicit path. It fails with:
Caused by: org.hibernate.sql.ast.tree.from.UnknownTableReferenceException: Unable to
determine TableReference (`home`) for `Customer(375683657376).home`
at
org.hibernate.sql.ast.tree.from.LazyTableGroup.resolveTableReference(LazyTableGroup.java:256)
at
org.hibernate.query.sqm.sql.internal.EntityValuedPathInterpretation.from(EntityValuedPathInterpretation.java:318)
at
org.hibernate.query.sqm.sql.internal.EntityValuedPathInterpretation.from(EntityValuedPathInterpretation.java:232)
at
org.hibernate.query.sqm.sql.internal.EntityValuedPathInterpretation.from(EntityValuedPathInterpretation.java:128)
at
org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.lambda$visitEntityValuedPath$57(BaseSqmToSqlAstConverter.java:3833)
at
org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.prepareReusablePath(BaseSqmToSqlAstConverter.java:3143)
at
org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.prepareReusablePath(BaseSqmToSqlAstConverter.java:3105)
at
org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitEntityValuedPath(BaseSqmToSqlAstConverter.java:3833)
at
org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitEntityValuedPath(BaseSqmToSqlAstConverter.java:414)
at
org.hibernate.query.sqm.tree.domain.SqmEntityValuedSimplePath.accept(SqmEntityValuedSimplePath.java:62)
(
https://hibernate.atlassian.net/browse/HHH-15648#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15648#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100209- sha1:5956172 )