use of org.hibernate.sql.ast.tree.from.TableGroupJoin in project hibernate-orm by hibernate.
the class DiscriminatedCollectionPart method createTableGroupJoin.
@Override
public TableGroupJoin createTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, String explicitSourceAlias, SqlAstJoinType requestedJoinType, boolean fetched, boolean addsPredicate, SqlAliasBaseGenerator aliasBaseGenerator, SqlExpressionResolver sqlExpressionResolver, FromClauseAccess fromClauseAccess, SqlAstCreationContext creationContext) {
final SqlAstJoinType joinType;
if (requestedJoinType == null) {
joinType = SqlAstJoinType.INNER;
} else {
joinType = requestedJoinType;
}
final TableGroup tableGroup = createRootTableGroupJoin(navigablePath, lhs, explicitSourceAlias, requestedJoinType, fetched, null, aliasBaseGenerator, sqlExpressionResolver, fromClauseAccess, creationContext);
return new TableGroupJoin(navigablePath, joinType, tableGroup);
}
use of org.hibernate.sql.ast.tree.from.TableGroupJoin in project hibernate-orm by hibernate.
the class AbstractCompositeIdentifierMapping method createTableGroupJoin.
@Override
public TableGroupJoin createTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, String explicitSourceAlias, SqlAstJoinType requestedJoinType, boolean fetched, boolean addsPredicate, SqlAliasBaseGenerator aliasBaseGenerator, SqlExpressionResolver sqlExpressionResolver, FromClauseAccess fromClauseAccess, SqlAstCreationContext creationContext) {
final SqlAstJoinType joinType;
if (requestedJoinType == null) {
joinType = SqlAstJoinType.INNER;
} else {
joinType = requestedJoinType;
}
final TableGroup tableGroup = createRootTableGroupJoin(navigablePath, lhs, explicitSourceAlias, requestedJoinType, fetched, null, aliasBaseGenerator, sqlExpressionResolver, fromClauseAccess, creationContext);
return new TableGroupJoin(navigablePath, joinType, tableGroup, null);
}
use of org.hibernate.sql.ast.tree.from.TableGroupJoin in project hibernate-orm by hibernate.
the class ImplicitModelPartResultBuilderEmbeddable method buildResult.
@Override
public EmbeddableResult buildResult(JdbcValuesMetadata jdbcResultsMetadata, int resultPosition, BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver, DomainResultCreationState domainResultCreationState) {
final DomainResultCreationStateImpl creationStateImpl = ResultsHelper.impl(domainResultCreationState);
creationStateImpl.disallowPositionalSelections();
final TableGroup tableGroup = creationStateImpl.getFromClauseAccess().resolveTableGroup(navigablePath, np -> {
if (navigablePath.getParent() == null) {
throw new IllegalStateException("Could not determine LHS for implicit embeddable result builder - " + navigablePath);
}
final TableGroup parentTableGroup = creationStateImpl.getFromClauseAccess().getTableGroup(navigablePath.getParent());
final TableGroupJoin tableGroupJoin = modelPart.createTableGroupJoin(navigablePath, parentTableGroup, null, SqlAstJoinType.INNER, true, false, creationStateImpl);
parentTableGroup.addTableGroupJoin(tableGroupJoin);
return tableGroupJoin.getJoinedGroup();
});
return (EmbeddableResult) modelPart.createDomainResult(navigablePath, tableGroup, null, domainResultCreationState);
}
use of org.hibernate.sql.ast.tree.from.TableGroupJoin in project hibernate-orm by hibernate.
the class ImplicitFetchBuilderEmbeddable method buildFetch.
@Override
public Fetch buildFetch(FetchParent parent, NavigablePath fetchPath, JdbcValuesMetadata jdbcResultsMetadata, BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver, DomainResultCreationState creationState) {
final DomainResultCreationStateImpl creationStateImpl = impl(creationState);
final TableGroup tableGroup = creationStateImpl.getFromClauseAccess().resolveTableGroup(fetchPath, navigablePath -> {
final TableGroup parentTableGroup = creationStateImpl.getFromClauseAccess().getTableGroup(parent.getNavigablePath());
final TableGroupJoin tableGroupJoin = fetchable.createTableGroupJoin(fetchPath, parentTableGroup, null, SqlAstJoinType.INNER, true, false, creationStateImpl);
parentTableGroup.addTableGroupJoin(tableGroupJoin);
return tableGroupJoin.getJoinedGroup();
});
final Fetch fetch = parent.generateFetchableFetch(fetchable, fetchPath, FetchTiming.IMMEDIATE, true, null, creationState);
return fetch;
}
use of org.hibernate.sql.ast.tree.from.TableGroupJoin in project hibernate-orm by hibernate.
the class AbstractSqlAstTranslator method hasNestedTableGroupsToRender.
protected boolean hasNestedTableGroupsToRender(List<TableGroupJoin> nestedTableGroupJoins) {
for (TableGroupJoin nestedTableGroupJoin : nestedTableGroupJoins) {
final TableGroup joinedGroup = nestedTableGroupJoin.getJoinedGroup();
final TableGroup realTableGroup;
if (joinedGroup instanceof LazyTableGroup) {
realTableGroup = ((LazyTableGroup) joinedGroup).getUnderlyingTableGroup();
} else {
realTableGroup = joinedGroup;
}
if (realTableGroup instanceof VirtualTableGroup) {
if (hasNestedTableGroupsToRender(realTableGroup.getNestedTableGroupJoins())) {
return true;
}
} else if (realTableGroup != null) {
return true;
}
}
return false;
}
Aggregations