Search in sources :

Example 1 with SelectionImplementor

use of org.hibernate.query.criteria.internal.SelectionImplementor in project hibernate-reactive by hibernate.

the class ReactiveCriteriaQueryImpl method build.

public ReactiveQuery<T> build(CriteriaQueryRenderingContext context, ReactiveQueryExecutor session) {
    final SelectionImplementor<?> selection = (SelectionImplementor<?>) getSelection();
    ReactiveQuery<T> query = session.createReactiveCriteriaQuery(renderQuery(context), getResultType(), new CriteriaQueryOptions() {

        @Override
        public SelectionImplementor<?> getSelection() {
            return selection;
        }

        @Override
        public InterpretedParameterMetadata getParameterMetadata() {
            return context;
        }

        @Override
        @SuppressWarnings("rawtypes")
        public List<ValueHandlerFactory.ValueHandler> getValueHandlers() {
            return selection == null ? null : selection.getValueHandlers();
        }

        @Override
        public void validate(Type[] returnTypes) {
            if (selection != null) {
                validateSelection(returnTypes, selection);
            }
        }
    });
    for (ImplicitParameterBinding implicitParameterBinding : context.implicitParameterBindings()) {
        implicitParameterBinding.bind((TypedQuery<?>) query);
    }
    return query;
}
Also used : SelectionImplementor(org.hibernate.query.criteria.internal.SelectionImplementor) InterpretedParameterMetadata(org.hibernate.query.criteria.internal.compile.InterpretedParameterMetadata) ValueHandlerFactory(org.hibernate.query.criteria.internal.ValueHandlerFactory) Type(org.hibernate.type.Type) CriteriaQueryOptions(org.hibernate.reactive.session.CriteriaQueryOptions) List(java.util.List) ImplicitParameterBinding(org.hibernate.query.criteria.internal.compile.ImplicitParameterBinding)

Aggregations

List (java.util.List)1 SelectionImplementor (org.hibernate.query.criteria.internal.SelectionImplementor)1 ValueHandlerFactory (org.hibernate.query.criteria.internal.ValueHandlerFactory)1 ImplicitParameterBinding (org.hibernate.query.criteria.internal.compile.ImplicitParameterBinding)1 InterpretedParameterMetadata (org.hibernate.query.criteria.internal.compile.InterpretedParameterMetadata)1 CriteriaQueryOptions (org.hibernate.reactive.session.CriteriaQueryOptions)1 Type (org.hibernate.type.Type)1