Search in sources :

Example 1 with FilterJdbcParameter

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

the class AbstractSqlAstTranslator method visitFilterPredicate.

@Override
public void visitFilterPredicate(FilterPredicate filterPredicate) {
    visitJunction(filterPredicate.getFragments());
    final List<FilterJdbcParameter> parameters = filterPredicate.getParameters();
    if (parameters != null) {
        for (FilterJdbcParameter filterJdbcParameter : parameters) {
            parameterBinders.add(filterJdbcParameter.getBinder());
            jdbcParameters.addParameter(filterJdbcParameter.getParameter());
            filterJdbcParameters.add(filterJdbcParameter);
        }
    }
}
Also used : FilterJdbcParameter(org.hibernate.internal.FilterJdbcParameter)

Example 2 with FilterJdbcParameter

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

the class AbstractSqlAstTranslator method translate.

@Override
public T translate(JdbcParameterBindings jdbcParameterBindings, QueryOptions queryOptions) {
    try {
        this.jdbcParameterBindings = jdbcParameterBindings;
        this.lockOptions = queryOptions.getLockOptions().makeCopy();
        this.limit = queryOptions.getLimit() == null ? null : queryOptions.getLimit().makeCopy();
        final JdbcOperation jdbcOperation;
        if (statement instanceof DeleteStatement) {
            jdbcOperation = translateDelete((DeleteStatement) statement);
        } else if (statement instanceof UpdateStatement) {
            jdbcOperation = translateUpdate((UpdateStatement) statement);
        } else if (statement instanceof InsertStatement) {
            jdbcOperation = translateInsert((InsertStatement) statement);
        } else if (statement instanceof SelectStatement) {
            jdbcOperation = translateSelect((SelectStatement) statement);
        } else {
            throw new IllegalArgumentException("Unexpected statement!");
        }
        if (jdbcParameterBindings != null && CollectionHelper.isNotEmpty(getFilterJdbcParameters())) {
            for (FilterJdbcParameter filterJdbcParameter : getFilterJdbcParameters()) {
                jdbcParameterBindings.addBinding(filterJdbcParameter.getParameter(), filterJdbcParameter.getBinding());
            }
        }
        return (T) jdbcOperation;
    } finally {
        cleanup();
    }
}
Also used : SelectStatement(org.hibernate.sql.ast.tree.select.SelectStatement) UpdateStatement(org.hibernate.sql.ast.tree.update.UpdateStatement) JdbcOperation(org.hibernate.sql.exec.spi.JdbcOperation) DeleteStatement(org.hibernate.sql.ast.tree.delete.DeleteStatement) FilterJdbcParameter(org.hibernate.internal.FilterJdbcParameter) InsertStatement(org.hibernate.sql.ast.tree.insert.InsertStatement)

Aggregations

FilterJdbcParameter (org.hibernate.internal.FilterJdbcParameter)2 DeleteStatement (org.hibernate.sql.ast.tree.delete.DeleteStatement)1 InsertStatement (org.hibernate.sql.ast.tree.insert.InsertStatement)1 SelectStatement (org.hibernate.sql.ast.tree.select.SelectStatement)1 UpdateStatement (org.hibernate.sql.ast.tree.update.UpdateStatement)1 JdbcOperation (org.hibernate.sql.exec.spi.JdbcOperation)1