[JIRA] (HHH-17001) An "on"-clause referencing the affected join node causes a StackOverflowException
by ortwin.escher (JIRA)
ortwin.escher ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5e89d19... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZjIxNTNhNzUw... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-17001?atlOrigin=eyJpIjoiZjIxNT... ) HHH-17001 ( https://hibernate.atlassian.net/browse/HHH-17001?atlOrigin=eyJpIjoiZjIxNT... ) An "on"-clause referencing the affected join node causes a StackOverflowException ( https://hibernate.atlassian.net/browse/HHH-17001?atlOrigin=eyJpIjoiZjIxNT... )
Change By: ortwin.escher ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5e89d19... )
When referencing a join node in an “on”-clause the lookup of the join node causes a StackOverflowError. This worked in Hibernate 5 and blocks us from migrating to Hibernate 6.
Code example:
{noformat}final Child someChildToCompareTo = new Child();
entityManager.persist(someChildToCompareTo);
final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
final CriteriaQuery<Parent> cq = cb.createQuery(Parent.class);
final Root<Parent> root = cq.from(Parent.class);
final SetJoin<Parent, Child> childrenJoin = root.join(Parent_.children);
// This will cause a StackOverflowError:
childrenJoin.on(cb.equal(childrenJoin, someChildToCompareTo));
entityManager.createQuery(cq).getResultList();{noformat}
A reproducer project is attached. I adapted the reproducer of [https://hibernate.atlassian.net/browse/HHH-16968|https://hibernate.atlass...] to demonstrate the problem.
Example Stacktrace excerpt:
{code:none} at org.hibernate.query.sqm.SemanticQueryWalker.visitSetJoin(SemanticQueryWalker.java:211) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.tree.domain.SqmSetJoin.accept(SqmSetJoin.java:85) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.tree.jpa.ParameterCollector.lambda$visitComparisonPredicate$14(ParameterCollector.java:272) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.tree.jpa.ParameterCollector.withTypeInference(ParameterCollector.java:147) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.tree.jpa.ParameterCollector.visitComparisonPredicate(ParameterCollector.java:272) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.tree.predicate.SqmComparisonPredicate.accept(SqmComparisonPredicate.java:104) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.spi.BaseSemanticQueryWalker.visitQualifiedAttributeJoin(BaseSemanticQueryWalker.java:296) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.SemanticQueryWalker.visitSetJoin(SemanticQueryWalker.java:211) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.tree.domain.SqmSetJoin.accept(SqmSetJoin.java:85) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.tree.jpa.ParameterCollector.lambda$visitComparisonPredicate$14(ParameterCollector.java:272) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.tree.jpa.ParameterCollector.withTypeInference(ParameterCollector.java:147) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.tree.jpa.ParameterCollector.visitComparisonPredicate(ParameterCollector.java:272) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.tree.predicate.SqmComparisonPredicate.accept(SqmComparisonPredicate.java:104) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.spi.BaseSemanticQueryWalker.visitQualifiedAttributeJoin(BaseSemanticQueryWalker.java:296) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.SemanticQueryWalker.visitSetJoin(SemanticQueryWalker.java:211) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.tree.domain.SqmSetJoin.accept(SqmSetJoin.java:85) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.tree.jpa.ParameterCollector.lambda$visitComparisonPredicate$14(ParameterCollector.java:272) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.tree.jpa.ParameterCollector.withTypeInference(ParameterCollector.java:147) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.tree.jpa.ParameterCollector.visitComparisonPredicate(ParameterCollector.java:272) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.tree.predicate.SqmComparisonPredicate.accept(SqmComparisonPredicate.java:104) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.spi.BaseSemanticQueryWalker.visitQualifiedAttributeJoin(BaseSemanticQueryWalker.java:296) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.SemanticQueryWalker.visitSetJoin(SemanticQueryWalker.java:211) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]
at org.hibernate.query.sqm.tree.domain.SqmSetJoin.accept(SqmSetJoin.java:85) ~[hibernate-core-6.3.0.CR1.jar:6.3.0.CR1]{code}
( https://hibernate.atlassian.net/browse/HHH-17001#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-17001#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=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100233- sha1:63d45e1 )
2 years, 4 months