HHH-17445 Don't force initialization of correlated joined table group
This commit is contained in:
parent
314c621f7b
commit
e0875a127f
|
@ -3786,8 +3786,6 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
|||
querySpec::applyPredicate,
|
||||
this
|
||||
);
|
||||
// Force initialization of a possible lazy table group
|
||||
tableGroup.getPrimaryTableReference();
|
||||
querySpec.getFromClause().addRoot( tableGroup );
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.assertj.core.api.Assertions;
|
|||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@JiraKey("HHH-16721")
|
||||
@DomainModel(annotatedClasses = {
|
||||
ImplicitJoinInSubqueryTest.A.class,
|
||||
ImplicitJoinInSubqueryTest.B.class,
|
||||
|
@ -28,6 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
public class ImplicitJoinInSubqueryTest {
|
||||
|
||||
@Test
|
||||
@JiraKey("HHH-16721")
|
||||
public void testImplicitJoinInSubquery(SessionFactoryScope scope) {
|
||||
SQLStatementInspector statementInspector = scope.getCollectingStatementInspector();
|
||||
statementInspector.clear();
|
||||
|
@ -41,6 +41,22 @@ public class ImplicitJoinInSubqueryTest {
|
|||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@JiraKey("HHH-17445")
|
||||
public void testImplicitJoinInSubquery2(SessionFactoryScope scope) {
|
||||
SQLStatementInspector statementInspector = scope.getCollectingStatementInspector();
|
||||
statementInspector.clear();
|
||||
scope.inTransaction(
|
||||
entityManager -> {
|
||||
entityManager.createSelectionQuery(
|
||||
"select a from A a where exists (select 1 from B b where a.b.c is null)"
|
||||
).getResultList();
|
||||
assertThat( statementInspector.getSqlQueries().get( 0 ) ).contains( "b1_0.c_id is null" );
|
||||
assertThat( statementInspector.getSqlQueries().get( 0 ) ).doesNotContain( ".id=b1_0.c_id" );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Entity(name = "A")
|
||||
public static class A {
|
||||
@Id
|
||||
|
|
Loading…
Reference in New Issue