Package org.apache.openjpa.jdbc.meta

Examples of org.apache.openjpa.jdbc.meta.Joinable


        }
        if (set && !canSetAny(io, fromCols.length, false))
            return;

        ClassMapping toMapping = (ClassMapping) to.getMetaData();
        Joinable join;
        Object val;
        for (int i = 0; i < toCols.length; i++) {
            // don't even translate join value if unsettable
            if (set) {
                if (_action == ACTION_INSERT && fromCols[i].isAutoAssigned())
                    continue;
                if (!canSet(io, i, false))
                    continue;
            }

            join = toMapping.assertJoinable(toCols[i]);
            val = join.getJoinValue(to, toCols[i], (JDBCStore) to.
                getContext().getStoreManager().getInnermostDelegate());
            if (set && val == null) {
                if (canSet(io, i, true))
                    setNull(fromCols[i]);
            } else if (set && val instanceof Raw)
View Full Code Here


        col = field.getForeignKey().getPrimaryKeyColumn(col);
        if (col == null)
            throw new InternalException();

        ClassMapping relmapping = field.getTypeMapping();
        Joinable j = field.getTypeMapping().assertJoinable(col);
        if (ImplHelper.isManageable(fieldVal))
            fieldVal = store.getContext().getObjectId(fieldVal);
        if (fieldVal instanceof OpenJPAId)
            fieldVal = ((OpenJPAId) fieldVal).getIdObject();
        if (relmapping.getObjectIdType() != null
            && relmapping.getObjectIdType().isInstance(fieldVal)) {
            Object[] pks = ApplicationIds.toPKValues(fieldVal, relmapping);
            fieldVal = pks[relmapping.getField(j.getFieldIndex()).
                getPrimaryKeyIndex()];
        }
        return j.getJoinValue(fieldVal, col, store);
    }
View Full Code Here

            pk.setLogical(!adapt);
            pk.setColumns(pkCols);
        }

        // map joinables
        Joinable join;
        Column[] cols;
        for (int i = 0; i < pkCols.length; i++) {
            // may have already registered a multi-column joinable
            if (cls.getJoinable(pkCols[i]) != null)
                continue;

            // create joinable that delegates all methods to the superclass'
            // joinable, but changes the columns as appropriate using
            // our superclass join fk
            join = sup.assertJoinable(fk.getPrimaryKeyColumn(pkCols[i]));
            join = new DelegatingJoinable(join, fk);
            cols = join.getColumns();
            for (int j = 0; j < cols.length; j++)
                cls.setJoinable(cols[j], join);
        }
    }
View Full Code Here

      boolean collectParmValueOnly = (parmList != null ? true : false);
        Object[] pks = null;
        if (mapping.getIdentityType() == ClassMapping.ID_APPLICATION)
            pks = ApplicationIds.toPKValues(oid, mapping);

        Joinable join;
        Object val;
        int count = 0;
        for (int i = 0; i < toCols.length; i++, count++) {
            if (pks == null)
                val = (oid == null) ? null : Numbers.valueOf(((Id) oid).getId());
            else {
                // must be app identity; use pk index to get correct pk value
                join = mapping.assertJoinable(toCols[i]);
                val = pks[mapping.getField(join.getFieldIndex()).
                    getPrimaryKeyIndex()];
                val = join.getJoinValue(val, toCols[i], store);
                if (parmList != null)
                  parmList.add(val);
            }
           
            if (collectParmValueOnly)
View Full Code Here

      boolean collectParmValueOnly = (parmList != null ? true : false);
        Object[] pks = null;
        if (mapping.getIdentityType() == ClassMapping.ID_APPLICATION)
            pks = ApplicationIds.toPKValues(oid, mapping);

        Joinable join;
        Object val;
        int count = 0;
        for (int i = 0; i < toCols.length; i++, count++) {
            if (pks == null)
                val = (oid == null) ? null : Numbers.valueOf(((Id) oid).getId());
            else {
                // must be app identity; use pk index to get correct pk value
                join = mapping.assertJoinable(toCols[i]);
                val = pks[mapping.getField(join.getFieldIndex()).
                    getPrimaryKeyIndex()];
                val = join.getJoinValue(val, toCols[i], store);
                if (parmList != null)
                  parmList.add(val);
            }
           
            if (collectParmValueOnly)
View Full Code Here

        col = field.getForeignKey().getPrimaryKeyColumn(col);
        if (col == null)
            throw new InternalException();

        ClassMapping relmapping = field.getTypeMapping();
        Joinable j = field.getTypeMapping().assertJoinable(col);
        if (ImplHelper.isManageable(fieldVal))
            fieldVal = store.getContext().getObjectId(fieldVal);
        if (fieldVal instanceof OpenJPAId)
            fieldVal = ((OpenJPAId) fieldVal).getIdObject();
        if (relmapping.getObjectIdType() != null
            && relmapping.getObjectIdType().isInstance(fieldVal)) {
            Object[] pks = ApplicationIds.toPKValues(fieldVal, relmapping);
            fieldVal = pks[relmapping.getField(j.getFieldIndex()).
                getPrimaryKeyIndex()];
        }
        return j.getJoinValue(fieldVal, col, store);
    }
View Full Code Here

        Object[] pks = null;
        if (mapping.getIdentityType() == ClassMapping.ID_APPLICATION)
            pks = ApplicationIds.toPKValues(oid, mapping);

        SQLBuffer buf = new SQLBuffer(_dict);
        Joinable join;
        Object val;
        int count = 0;
        for (int i = 0; i < toCols.length; i++, count++) {
            if (pks == null)
                val = (oid == null) ? null :
                        Numbers.valueOf(((Id) oid).getId());
            else {
                // must be app identity; use pk index to get correct pk value
                join = mapping.assertJoinable(toCols[i]);
                val = pks[mapping.getField(join.getFieldIndex()).
                    getPrimaryKeyIndex()];
                val = join.getJoinValue(val, toCols[i], store);
            }

            if (count > 0)
                buf.append(" AND ");
            buf.append(getColumnAlias(fromCols[i], pj));
View Full Code Here

            throw new InternalException();
       
        Object savedFieldVal = fieldVal;

        ClassMapping relmapping = field.getTypeMapping();
        Joinable j = field.getTypeMapping().assertJoinable(col);
        if (ImplHelper.isManageable(fieldVal) && !field.getDefiningMetaData().useIdClassFromParent())
            fieldVal = store.getContext().getObjectId(fieldVal);
        if (fieldVal instanceof OpenJPAId)
            fieldVal = ((OpenJPAId) fieldVal).getIdObject();
        if (relmapping.getObjectIdType() != null
            && relmapping.getObjectIdType().isInstance(fieldVal)) {
            Object[] pks = ApplicationIds.toPKValues(fieldVal, relmapping);
            fieldVal = pks[relmapping.getField(j.getFieldIndex()).
                getPrimaryKeyIndex()];
        } else if (relmapping.getObjectIdType() == ObjectId.class &&
            relmapping.getPrimaryKeyFieldMappings()[0].getValueMapping().isEmbedded()) {
            return j.getJoinValue(savedFieldVal, col, store);
        }
        return j.getJoinValue(fieldVal, col, store);
    }
View Full Code Here

        col = field.getForeignKey().getPrimaryKeyColumn(col);
        if (col == null)
            throw new InternalException();

        ClassMapping relmapping = field.getTypeMapping();
        Joinable j = field.getTypeMapping().assertJoinable(col);
        if (ImplHelper.isManageable(fieldVal))
            fieldVal = store.getContext().getObjectId(fieldVal);
        if (fieldVal instanceof OpenJPAId)
            fieldVal = ((OpenJPAId) fieldVal).getIdObject();
        else if (relmapping.getObjectIdType() != null
            && relmapping.getObjectIdType().isInstance(fieldVal)) {
            Object[] pks = ApplicationIds.toPKValues(fieldVal, relmapping);
            fieldVal = pks[relmapping.getField(j.getFieldIndex()).
                getPrimaryKeyIndex()];
        }
        return j.getJoinValue(fieldVal, col, store);
    }
View Full Code Here

        Object[] pks = null;
        if (mapping.getIdentityType() == ClassMapping.ID_APPLICATION)
            pks = ApplicationIds.toPKValues(oid, mapping);

        SQLBuffer buf = new SQLBuffer(_dict);
        Joinable join;
        Object val;
        int count = 0;
        for (int i = 0; i < toCols.length; i++, count++) {
            if (pks == null)
                val = (oid == null) ? null : Numbers.valueOf(((Id) oid).getId());
            else {
                // must be app identity; use pk index to get correct pk value
                join = mapping.assertJoinable(toCols[i]);
                val = pks[mapping.getField(join.getFieldIndex()).
                    getPrimaryKeyIndex()];
                val = join.getJoinValue(val, toCols[i], store);
            }

            if (count > 0)
                buf.append(" AND ");
            buf.append(getColumnAlias(fromCols[i], pj));
View Full Code Here

TOP

Related Classes of org.apache.openjpa.jdbc.meta.Joinable

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.