Search in sources :

Example 1 with HpCBPurpose

use of org.dbflute.cbean.chelper.HpCBPurpose in project dbflute-core by dbflute.

the class AbstractConditionBean method xhandleOrSQPurposeChange.

protected HpCBPurpose xhandleOrSQPurposeChange() {
    // might be overridden before Java8
    final HpCBPurpose originalPurpose = getPurpose();
    xsetupForOrScopeQuery();
    return originalPurpose;
}
Also used : HpCBPurpose(org.dbflute.cbean.chelper.HpCBPurpose)

Example 2 with HpCBPurpose

use of org.dbflute.cbean.chelper.HpCBPurpose in project dbflute-core by dbflute.

the class AbstractConditionBean method xdoOrSQ.

protected <CB extends ConditionBean> void xdoOrSQ(CB cb, OrQuery<CB> orQuery) {
    getSqlClause().beginOrScopeQuery();
    final HpCBPurpose originalPurpose = xhandleOrSQPurposeChange();
    try {
        // cannot lock base condition-bean for now
        // because it uses same instance in or-scope query
        orQuery.query(cb);
    } finally {
        xhandleOrSQPurposeClose(originalPurpose);
        getSqlClause().endOrScopeQuery();
    }
}
Also used : HpCBPurpose(org.dbflute.cbean.chelper.HpCBPurpose)

Example 3 with HpCBPurpose

use of org.dbflute.cbean.chelper.HpCBPurpose in project dbflute-core by dbflute.

the class AbstractConditionBean method useInScopeSubQuery.

// [DBFlute-1.1.0]
// ===================================================================================
// ExistsReferrer Way
// ==================
/**
 * Use in-scope sub-query for exists-referrer, basically for performance tuning. <br>
 * The exists-referrer uses plain sub-query way instead of correlation way. <br>
 * <pre>
 * cb.query().existsPurchase(purchaseCB -&gt; {
 *     purchaseCB.<span style="color: #CC4747">useInScopeSubQuery()</span>;
 *     purchaseCB.query().set...
 *     purchaseCB.query().set...
 * });
 * </pre>
 */
public void useInScopeSubQuery() {
    assertOptionThatBadTiming("useInScopeSubQuery()");
    final HpCBPurpose purpose = getPurpose();
    if (!purpose.isAny(HpCBPurpose.EXISTS_REFERRER, HpCBPurpose.MYSELF_EXISTS)) {
        String msg = "The method 'useInScopeSubQuery()' can be called only when ExistsReferrer.";
        throw new IllegalConditionBeanOperationException(msg);
    }
    getSqlClause().useInScopeSubQueryForExistsReferrer();
}
Also used : IllegalConditionBeanOperationException(org.dbflute.exception.IllegalConditionBeanOperationException) HpCBPurpose(org.dbflute.cbean.chelper.HpCBPurpose)

Aggregations

HpCBPurpose (org.dbflute.cbean.chelper.HpCBPurpose)3 IllegalConditionBeanOperationException (org.dbflute.exception.IllegalConditionBeanOperationException)1