use of org.hibernate.persister.internal.SqlFragmentPredicate in project hibernate-orm by hibernate.
the class AbstractEntityPersister method applyWhereRestrictions.
@Override
public void applyWhereRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, SqlAstCreationState creationState) {
if (sqlWhereStringTemplate == null) {
return;
}
final String alias;
final TableReference tableReference;
if (tableGroup == null || (tableReference = tableGroup.resolveTableReference(sqlWhereStringTableExpression)) == null) {
alias = null;
} else {
if (useQualifier && tableReference.getIdentificationVariable() != null) {
alias = tableReference.getIdentificationVariable();
} else {
alias = tableReference.getTableId();
}
}
final String fragment = StringHelper.replace(sqlWhereStringTemplate, Template.TEMPLATE, alias);
predicateConsumer.accept(new SqlFragmentPredicate(fragment));
}
use of org.hibernate.persister.internal.SqlFragmentPredicate in project hibernate-orm by hibernate.
the class AbstractCollectionPersister method applyWhereFragments.
/**
* Applies all defined {@link org.hibernate.annotations.Where}
*/
private static void applyWhereFragments(Consumer<Predicate> predicateConsumer, String alias, String template) {
if (template == null) {
return;
}
final String fragment = StringHelper.replace(template, Template.TEMPLATE, alias);
if (StringHelper.isEmpty(fragment)) {
return;
}
predicateConsumer.accept(new SqlFragmentPredicate(fragment));
}
Aggregations