Search in sources :

Example 1 with ConstraintFieldDesc

use of com.sun.jdo.spi.persistence.support.sqlstore.sql.constraint.ConstraintFieldDesc in project Payara by payara.

the class CorrelatedExistSelectPlan method doCorrelatedJoin.

/**
 * The correlated constraint joining this subquery with the parent field.
 * The joined table is added as a side-effect.
 */
protected void doCorrelatedJoin() {
    ArrayList foreignFields = null;
    if (parentField.useJoinTable()) {
        foreignFields = parentField.assocLocalFields;
    // The join table is included in #processJoinTable
    } else {
        foreignFields = parentField.foreignFields;
    }
    ArrayList localFields = parentField.localFields;
    // Add the constraint linking the parent query with the subquery.
    for (int i = 0; i < localFields.size(); i++) {
        LocalFieldDesc la = (LocalFieldDesc) localFields.get(i);
        LocalFieldDesc fa = (LocalFieldDesc) foreignFields.get(i);
        ConstraintFieldDesc lcfd = new ConstraintFieldDesc(la, parentPlan);
        ConstraintFieldDesc fcfd = new ConstraintFieldDesc(fa, this);
        constraint.addField(lcfd);
        constraint.addField(fcfd);
        // Subqueries always join via equijoin.
        constraint.addOperation(ActionDesc.OP_EQ);
    }
}
Also used : ConstraintFieldDesc(com.sun.jdo.spi.persistence.support.sqlstore.sql.constraint.ConstraintFieldDesc) LocalFieldDesc(com.sun.jdo.spi.persistence.support.sqlstore.model.LocalFieldDesc) ArrayList(java.util.ArrayList)

Aggregations

LocalFieldDesc (com.sun.jdo.spi.persistence.support.sqlstore.model.LocalFieldDesc)1 ConstraintFieldDesc (com.sun.jdo.spi.persistence.support.sqlstore.sql.constraint.ConstraintFieldDesc)1 ArrayList (java.util.ArrayList)1