use of org.hibernate.sql.ast.tree.from.TableGroupJoin in project hibernate-orm by hibernate.
the class EmbeddedCollectionPart 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 PluralAttributeMappingImpl 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 java.util.List<Predicate> predicates = new ArrayList<>(2);
final TableGroup tableGroup = createRootTableGroupJoin(navigablePath, lhs, explicitSourceAlias, requestedJoinType, fetched, predicates::add, aliasBaseGenerator, sqlExpressionResolver, fromClauseAccess, creationContext);
final TableGroupJoin tableGroupJoin = new TableGroupJoin(navigablePath, joinType, tableGroup, null);
predicates.forEach(tableGroupJoin::applyPredicate);
return tableGroupJoin;
}
use of org.hibernate.sql.ast.tree.from.TableGroupJoin in project hibernate-orm by hibernate.
the class PluralAttributeMappingImpl method createCollectionTableGroup.
private TableGroup createCollectionTableGroup(boolean canUseInnerJoins, NavigablePath navigablePath, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlExpressionResolver sqlExpressionResolver, FromClauseAccess fromClauseAccess, SqlAstCreationContext creationContext) {
assert !getCollectionDescriptor().isOneToMany();
final String collectionTableName = ((Joinable) collectionDescriptor).getTableName();
final TableReference collectionTableReference = new NamedTableReference(collectionTableName, sqlAliasBase.generateNewAlias(), true, creationContext.getSessionFactory());
final CollectionTableGroup tableGroup = new CollectionTableGroup(canUseInnerJoins, navigablePath, this, fetched, sourceAlias, collectionTableReference, true, sqlAliasBase, s -> false, null, creationContext.getSessionFactory());
if (elementDescriptor instanceof TableGroupJoinProducer) {
final TableGroupJoin tableGroupJoin = ((TableGroupJoinProducer) elementDescriptor).createTableGroupJoin(navigablePath.append(CollectionPart.Nature.ELEMENT.getName()), tableGroup, null, SqlAstJoinType.INNER, fetched, false, stem -> sqlAliasBase, sqlExpressionResolver, fromClauseAccess, creationContext);
tableGroup.registerElementTableGroup(tableGroupJoin);
}
if (indexDescriptor instanceof TableGroupJoinProducer) {
final TableGroupJoin tableGroupJoin = ((TableGroupJoinProducer) indexDescriptor).createTableGroupJoin(navigablePath.append(CollectionPart.Nature.INDEX.getName()), tableGroup, null, SqlAstJoinType.INNER, fetched, false, stem -> sqlAliasBase, sqlExpressionResolver, fromClauseAccess, creationContext);
tableGroup.registerIndexTableGroup(tableGroupJoin);
}
return tableGroup;
}
use of org.hibernate.sql.ast.tree.from.TableGroupJoin in project hibernate-orm by hibernate.
the class PluralAttributeMappingImpl method createOneToManyTableGroup.
private TableGroup createOneToManyTableGroup(boolean canUseInnerJoins, NavigablePath navigablePath, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlExpressionResolver sqlExpressionResolver, FromClauseAccess fromClauseAccess, SqlAstCreationContext creationContext) {
final TableGroup elementTableGroup = ((EntityCollectionPart) elementDescriptor).createTableGroupInternal(canUseInnerJoins, navigablePath.append(CollectionPart.Nature.ELEMENT.getName()), fetched, sourceAlias, sqlAliasBase, sqlExpressionResolver, creationContext);
final OneToManyTableGroup tableGroup = new OneToManyTableGroup(this, elementTableGroup, creationContext.getSessionFactory());
if (indexDescriptor instanceof TableGroupJoinProducer) {
final TableGroupJoin tableGroupJoin = ((TableGroupJoinProducer) indexDescriptor).createTableGroupJoin(navigablePath.append(CollectionPart.Nature.INDEX.getName()), tableGroup, null, SqlAstJoinType.INNER, fetched, false, stem -> sqlAliasBase, sqlExpressionResolver, fromClauseAccess, creationContext);
tableGroup.registerIndexTableGroup(tableGroupJoin);
}
return tableGroup;
}
use of org.hibernate.sql.ast.tree.from.TableGroupJoin in project hibernate-orm by hibernate.
the class DiscriminatedAssociationAttributeMapping 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);
}
Aggregations