Search in sources :

Example 1 with FilterAliasGenerator

use of org.hibernate.internal.FilterAliasGenerator in project hibernate-orm by hibernate.

the class AbstractEntityPersister method applyFilterRestrictions.

@Override
public void applyFilterRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String, Filter> enabledFilters, SqlAstCreationState creationState) {
    if (filterHelper == null) {
        return;
    }
    final FilterAliasGenerator filterAliasGenerator = useQualifier && tableGroup != null ? getFilterAliasGenerator(tableGroup) : null;
    filterHelper.applyEnabledFilters(predicateConsumer, filterAliasGenerator, enabledFilters);
}
Also used : FilterAliasGenerator(org.hibernate.internal.FilterAliasGenerator)

Example 2 with FilterAliasGenerator

use of org.hibernate.internal.FilterAliasGenerator in project hibernate-orm by hibernate.

the class AbstractCollectionPersister method applyBaseManyToManyRestrictions.

@Override
public void applyBaseManyToManyRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String, Filter> enabledFilters, Set<String> treatAsDeclarations, SqlAstCreationState creationState) {
    if (manyToManyFilterHelper == null && manyToManyWhereTemplate == null) {
        return;
    }
    if (manyToManyFilterHelper != null) {
        final FilterAliasGenerator aliasGenerator = elementPersister.getFilterAliasGenerator(tableGroup);
        manyToManyFilterHelper.applyEnabledFilters(predicateConsumer, aliasGenerator, enabledFilters);
    }
    if (manyToManyWhereString != null) {
        final TableReference tableReference = tableGroup.resolveTableReference(((Joinable) elementPersister).getTableName());
        final String alias;
        if (tableReference == null) {
            alias = null;
        } else if (useQualifier && tableReference.getIdentificationVariable() != null) {
            alias = tableReference.getIdentificationVariable();
        } else {
            alias = tableReference.getTableId();
        }
        applyWhereFragments(predicateConsumer, alias, manyToManyWhereTemplate);
    }
}
Also used : TableReference(org.hibernate.sql.ast.tree.from.TableReference) FilterAliasGenerator(org.hibernate.internal.FilterAliasGenerator)

Aggregations

FilterAliasGenerator (org.hibernate.internal.FilterAliasGenerator)2 TableReference (org.hibernate.sql.ast.tree.from.TableReference)1