Search in sources :

Example 1 with CustomReturningSQLTypedQuery

use of com.blazebit.persistence.impl.query.CustomReturningSQLTypedQuery in project blaze-persistence by Blazebit.

the class AbstractDeleteCollectionCriteriaBuilder method getExecuteWithReturningQuery.

@Override
protected <R> TypedQuery<ReturningResult<R>> getExecuteWithReturningQuery(TypedQuery<Object[]> exampleQuery, Query baseQuery, String[] returningColumns, ReturningObjectBuilder<R> objectBuilder) {
    if (collectionAttribute.getJoinTable() == null) {
        return super.getExecuteWithReturningQuery(exampleQuery, baseQuery, returningColumns, objectBuilder);
    } else {
        QuerySpecification querySpecification = getQuerySpecification(baseQuery, exampleQuery, returningColumns, objectBuilder, null);
        CustomReturningSQLTypedQuery query = new CustomReturningSQLTypedQuery<R>(querySpecification, exampleQuery, parameterManager.getCriteriaNameMapping(), parameterManager.getTransformers(), parameterManager.getValuesParameters(), parameterManager.getValuesBinders());
        parameterManager.parameterizeQuery(query);
        return query;
    }
}
Also used : QuerySpecification(com.blazebit.persistence.impl.query.QuerySpecification) CollectionDeleteModificationQuerySpecification(com.blazebit.persistence.impl.query.CollectionDeleteModificationQuerySpecification) CustomReturningSQLTypedQuery(com.blazebit.persistence.impl.query.CustomReturningSQLTypedQuery)

Example 2 with CustomReturningSQLTypedQuery

use of com.blazebit.persistence.impl.query.CustomReturningSQLTypedQuery in project blaze-persistence by Blazebit.

the class AbstractModificationCriteriaBuilder method getExecuteWithReturningQuery.

protected <R> TypedQuery<ReturningResult<R>> getExecuteWithReturningQuery(TypedQuery<Object[]> exampleQuery, Query baseQuery, String[] returningColumns, ReturningObjectBuilder<R> objectBuilder) {
    Set<String> parameterListNames = parameterManager.getParameterListNames(baseQuery);
    boolean shouldRenderCteNodes = renderCteNodes(false);
    List<CTENode> ctes = shouldRenderCteNodes ? getCteNodes(false) : Collections.EMPTY_LIST;
    QuerySpecification querySpecification = new ModificationQuerySpecification(this, baseQuery, exampleQuery, parameterManager.getParameterImpls(), parameterListNames, mainQuery.cteManager.isRecursive(), ctes, shouldRenderCteNodes, false, returningColumns, objectBuilder, null, returningAttributeBindingMap, mainQuery.getQueryConfiguration().isQueryPlanCacheEnabled());
    CustomReturningSQLTypedQuery query = new CustomReturningSQLTypedQuery<R>(querySpecification, exampleQuery, parameterManager.getCriteriaNameMapping(), parameterManager.getTransformers(), parameterManager.getValuesParameters(), parameterManager.getValuesBinders());
    query.setFirstResult(firstResult);
    query.setMaxResults(maxResults);
    parameterManager.parameterizeQuery(query);
    return query;
}
Also used : QuerySpecification(com.blazebit.persistence.impl.query.QuerySpecification) ModificationQuerySpecification(com.blazebit.persistence.impl.query.ModificationQuerySpecification) CustomReturningSQLTypedQuery(com.blazebit.persistence.impl.query.CustomReturningSQLTypedQuery) CTENode(com.blazebit.persistence.impl.query.CTENode) ModificationQuerySpecification(com.blazebit.persistence.impl.query.ModificationQuerySpecification)

Example 3 with CustomReturningSQLTypedQuery

use of com.blazebit.persistence.impl.query.CustomReturningSQLTypedQuery in project blaze-persistence by Blazebit.

the class AbstractUpdateCollectionCriteriaBuilder method getExecuteWithReturningQuery.

@Override
protected <R> TypedQuery<ReturningResult<R>> getExecuteWithReturningQuery(TypedQuery<Object[]> exampleQuery, Query baseQuery, String[] returningColumns, ReturningObjectBuilder<R> objectBuilder) {
    if (collectionAttribute.getJoinTable() == null) {
        return super.getExecuteWithReturningQuery(exampleQuery, baseQuery, returningColumns, objectBuilder);
    } else {
        QuerySpecification querySpecification = getQuerySpecification(baseQuery, exampleQuery, returningColumns, objectBuilder, null);
        CustomReturningSQLTypedQuery query = new CustomReturningSQLTypedQuery<R>(querySpecification, exampleQuery, parameterManager.getCriteriaNameMapping(), parameterManager.getTransformers(), parameterManager.getValuesParameters(), parameterManager.getValuesBinders());
        parameterManager.parameterizeQuery(query);
        return query;
    }
}
Also used : QuerySpecification(com.blazebit.persistence.impl.query.QuerySpecification) CollectionUpdateModificationQuerySpecification(com.blazebit.persistence.impl.query.CollectionUpdateModificationQuerySpecification) CustomReturningSQLTypedQuery(com.blazebit.persistence.impl.query.CustomReturningSQLTypedQuery)

Example 4 with CustomReturningSQLTypedQuery

use of com.blazebit.persistence.impl.query.CustomReturningSQLTypedQuery in project blaze-persistence by Blazebit.

the class BaseUpdateCriteriaBuilderImpl method getExecuteWithReturningQuery.

@Override
protected <R> TypedQuery<ReturningResult<R>> getExecuteWithReturningQuery(TypedQuery<Object[]> exampleQuery, Query baseQuery, String[] returningColumns, ReturningObjectBuilder<R> objectBuilder) {
    QuerySpecification querySpecification = getQuerySpecification(baseQuery, exampleQuery, returningColumns, objectBuilder, null);
    CustomReturningSQLTypedQuery<R> query = new CustomReturningSQLTypedQuery<R>(querySpecification, exampleQuery, parameterManager.getCriteriaNameMapping(), parameterManager.getTransformers(), parameterManager.getValuesParameters(), parameterManager.getValuesBinders());
    query.setFirstResult(firstResult);
    query.setMaxResults(maxResults);
    parameterManager.parameterizeQuery(query);
    return query;
}
Also used : QuerySpecification(com.blazebit.persistence.impl.query.QuerySpecification) UpdateModificationQuerySpecification(com.blazebit.persistence.impl.query.UpdateModificationQuerySpecification) CustomReturningSQLTypedQuery(com.blazebit.persistence.impl.query.CustomReturningSQLTypedQuery)

Example 5 with CustomReturningSQLTypedQuery

use of com.blazebit.persistence.impl.query.CustomReturningSQLTypedQuery in project blaze-persistence by Blazebit.

the class BaseDeleteCriteriaBuilderImpl method getExecuteWithReturningQuery.

@Override
protected <R> TypedQuery<ReturningResult<R>> getExecuteWithReturningQuery(TypedQuery<Object[]> exampleQuery, Query baseQuery, String[] returningColumns, ReturningObjectBuilder<R> objectBuilder) {
    QuerySpecification querySpecification = getQuerySpecification(baseQuery, exampleQuery, returningColumns, objectBuilder, null);
    CustomReturningSQLTypedQuery<R> query = new CustomReturningSQLTypedQuery<R>(querySpecification, exampleQuery, parameterManager.getCriteriaNameMapping(), parameterManager.getTransformers(), parameterManager.getValuesParameters(), parameterManager.getValuesBinders());
    query.setFirstResult(firstResult);
    query.setMaxResults(maxResults);
    parameterManager.parameterizeQuery(query);
    return query;
}
Also used : QuerySpecification(com.blazebit.persistence.impl.query.QuerySpecification) DeleteModificationQuerySpecification(com.blazebit.persistence.impl.query.DeleteModificationQuerySpecification) CustomReturningSQLTypedQuery(com.blazebit.persistence.impl.query.CustomReturningSQLTypedQuery)

Aggregations

CustomReturningSQLTypedQuery (com.blazebit.persistence.impl.query.CustomReturningSQLTypedQuery)6 QuerySpecification (com.blazebit.persistence.impl.query.QuerySpecification)6 CTENode (com.blazebit.persistence.impl.query.CTENode)1 CollectionDeleteModificationQuerySpecification (com.blazebit.persistence.impl.query.CollectionDeleteModificationQuerySpecification)1 CollectionInsertModificationQuerySpecification (com.blazebit.persistence.impl.query.CollectionInsertModificationQuerySpecification)1 CollectionUpdateModificationQuerySpecification (com.blazebit.persistence.impl.query.CollectionUpdateModificationQuerySpecification)1 DeleteModificationQuerySpecification (com.blazebit.persistence.impl.query.DeleteModificationQuerySpecification)1 ModificationQuerySpecification (com.blazebit.persistence.impl.query.ModificationQuerySpecification)1 UpdateModificationQuerySpecification (com.blazebit.persistence.impl.query.UpdateModificationQuerySpecification)1