All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.blazebit.persistence.ModificationCriteriaBuilder Maven / Gradle / Ivy

There is a newer version: 1.6.11
Show newest version
/*
 * Copyright 2014 - 2021 Blazebit.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.blazebit.persistence;

import javax.persistence.Tuple;
import javax.persistence.TypedQuery;

/**
 * A builder for modification queries.
 *
 * @param  The concrete builder type
 * @author Christian Beikov
 * @since 1.1.0
 */
public interface ModificationCriteriaBuilder> extends Executable, CommonQueryBuilder, BaseModificationCriteriaBuilder, CTEBuilder {

    /**
     * Returns the query root.
     *
     * @return The root of this query
     * @since 1.2.0
     */
    public From getRoot();

    /**
     * Executes the modification query and returns the given attributes as tuples.
     *
     * @param attributes The attributes of a changed entity to return
     * @return A result wrapper containing the update count and the new values of the attributes
     */
    public ReturningResult executeWithReturning(String... attributes);

    /**
     * Executes the modification query and returns the given attribute with the specified type.
     *
     * @param attribute The attribute of a changed entity to return
     * @param type The type of the attribute
     * @param  The result type of the attribute
     * @return A result wrapper containing the update count and the new value of the attribute
     */
    public  ReturningResult executeWithReturning(String attribute, Class type);

    /**
     * Executes the modification query and returns an object consisting of the attributes applied by the object builder.
     *
     * @param objectBuilder The object builder that applies attributes and constructs the result objects
     * @param  The type of the object constructed by the object builder
     * @return A result wrapper containing the update count and the objects constructed by the obbject builder
     */
    public  ReturningResult executeWithReturning(ReturningObjectBuilder objectBuilder);

    /**
     * Creates a query that contains the modification query and returns the given attributes as tuples.
     *
     * @param attributes The attributes of a changed entity to return
     * @return A result wrapper containing the update count and the new values of the attributes
     */
    public TypedQuery> getWithReturningQuery(String... attributes);

    /**
     * Creates a query that contains the modification query and returns the given attribute with the specified type.
     *
     * @param attribute The attribute of a changed entity to return
     * @param type The type of the attribute
     * @param  The result type of the attribute
     * @return A result wrapper containing the update count and the new value of the attribute
     */
    public  TypedQuery> getWithReturningQuery(String attribute, Class type);

    /**
     * Creates a query that contains the modification query and returns an object consisting of the attributes applied by the object builder.
     *
     * @param objectBuilder The object builder that applies attributes and constructs the result objects
     * @param  The type of the object constructed by the object builder
     * @return A result wrapper containing the update count and the objects constructed by the obbject builder
     */
    public  TypedQuery> getWithReturningQuery(ReturningObjectBuilder objectBuilder);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy