Package org.apache.openjpa.jdbc.sql

Examples of org.apache.openjpa.jdbc.sql.Joins


        throws SQLException {
        // do same joins as for load
        //### cheat: we know typical result joins only care about the relation
        //### path; thus we can ignore different mappings
        ClassMapping elem = getDefaultElementMapping(true);
        Joins dataJoins = res.newJoins().setVariable("*");
        dataJoins = join(dataJoins, elem);
        dataJoins = joinElementRelation(dataJoins, elem);
        Joins orderJoins = null;
        if (field.getOrderColumn() != null) {
            orderJoins = res.newJoins().setVariable("*");
            orderJoins = join(orderJoins, elem);
        }

View Full Code Here


        if (field.getTypeCode() == JavaTypes.ARRAY)
            coll = new ArrayList();
        else
            coll = sm.newProxy(field.getIndex());

        Joins dataJoins = null;
        Joins refJoins = res.newJoins().setVariable("*");
        join(refJoins, false);

        ClassMapping ownerMapping = field.getDefiningMapping();
        Object ref = null;
        int seq = 0;
View Full Code Here

            field.getDefiningMapping(), store);

        // order first, then select so that if the projection introduces
        // additional ordering, it will be after our required ordering
        field.orderLocal(sel, elem, null);
        Joins joins = joinElementRelation(sel.newJoins(), elem);
        field.orderRelation(sel, elem, joins);
        selectElement(sel, elem, store, fetch, eagerMode, joins);
        return joins;
    }
View Full Code Here

        return type;
    }

    public ExpState initialize(Select sel, ExpContext ctx, int flags) {
        ExpState[] states = new ExpState[_exp.length+2];
        Joins joins = null;

        states[0] = _caseOperand.initialize(sel, ctx, 0);
        if (joins == null)
            joins = states[0].joins;
        else
View Full Code Here

        return type;
    }

    public ExpState initialize(Select sel, ExpContext ctx, int flags) {
        ExpState[] states = new ExpState[_exp.length+1];
        Joins joins = null;
        int i = 0;
        for (; i < _exp.length; i++) {
            states[i] = _exp[i].initialize(sel, ctx, null);
            if (joins == null)
                joins = states[i].joins;
View Full Code Here

        // make sure it's joined down to its base type
        Discriminator discrim = (relMapping == null
            || !relMapping.getDescribedType().isAssignableFrom(_cls))
            ? null : relMapping.getDiscriminator();
        ClassMapping mapping = null;
        Joins joins = pathState.joins;
        if (discrim != null) {
            // cache mapping for cast
            MappingRepository repos = ctx.store.getConfiguration().
                getMappingRepositoryInstance();
            mapping = repos.getMapping(_cls, ctx.store.getContext().
View Full Code Here

        sel.selectPrimaryKey(field.getDefiningMapping());
        // set a variable name that does not conflict with any in the query;
        // using a variable guarantees that the selected data will use different
        // aliases and joins than any existing WHERE conditions on this field
        // that might otherwise limit the relations that match
        Joins joins = sel.newJoins().setVariable("*");
        eagerJoin(joins, cls, true);
        sel.select(cls, field.getSelectSubclasses(), store, fetch, eagerMode,
            joins);
    }
View Full Code Here

        throws SQLException {
        // do same joins as for load
        //### cheat: we know typical result joins only care about the relation
        //### path; thus we can ignore different mappings
        ClassMapping[] clss = field.getIndependentTypeMappings();
        Joins joins = res.newJoins().setVariable("*");
        eagerJoin(joins, clss[0], true);

        Map rels = new HashMap();
        ClassMapping owner = field.getDefiningMapping();
        ClassMapping cls;
View Full Code Here

        if (havingExp != null)
            state.having = havingExp.initialize(sel, ctx, contains);

        // get the top-level joins and null the expression's joins
        // at the same time so they aren't included in the where/having SQL
        Joins filterJoins = state.filter.joins;
        Joins havingJoins = (state.having == null) ? null : state.having.joins;
        Joins joins = sel.and(filterJoins, havingJoins);

        // initialize result values
        if (exps.projections.length > 0) {
            state.projections = new ExpState[exps.projections.length];
            Val resultVal;
View Full Code Here

    public void select(Select sel, ExpContext ctx, ClassMapping mapping,
        boolean subclasses, QueryExpressions exps, QueryExpressionsState state,
        int eager) {
        Select inner = sel.getFromSelect();
        Val val;
        Joins joins = null;
        boolean isCountDistinctMultiCols = false;

        if (sel.getSubselectPath() != null)
            joins = sel.newJoins().setSubselect(sel.getSubselectPath());
View Full Code Here

TOP

Related Classes of org.apache.openjpa.jdbc.sql.Joins

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.