mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-13 14:44:48 +00:00
HHH-17445 Don't force initialization of correlated joined table group
This commit is contained in:
parent
e369015b4d
commit
ac3b5281c3
@ -3741,8 +3741,6 @@ private TableGroup createTableGroup(TableGroup parentTableGroup, SqmPath<?> join
|
||||
querySpec::applyPredicate,
|
||||
this
|
||||
);
|
||||
// Force initialization of a possible lazy table group
|
||||
tableGroup.getPrimaryTableReference();
|
||||
querySpec.getFromClause().addRoot( tableGroup );
|
||||
}
|
||||
else {
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@JiraKey("HHH-16721")
|
||||
@DomainModel(annotatedClasses = {
|
||||
ImplicitJoinInSubqueryTest.A.class,
|
||||
ImplicitJoinInSubqueryTest.B.class,
|
||||
@ -28,6 +27,7 @@
|
||||
public class ImplicitJoinInSubqueryTest {
|
||||
|
||||
@Test
|
||||
@JiraKey("HHH-16721")
|
||||
public void testImplicitJoinInSubquery(SessionFactoryScope scope) {
|
||||
SQLStatementInspector statementInspector = scope.getCollectingStatementInspector();
|
||||
statementInspector.clear();
|
||||
@ -41,6 +41,22 @@ public void testImplicitJoinInSubquery(SessionFactoryScope scope) {
|
||||
);
|
||||
}
|
||||
|
||||
@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…
x
Reference in New Issue
Block a user