Package org.apache.openjpa.jdbc.schema

Examples of org.apache.openjpa.jdbc.schema.ColumnIO


            cols = vinfo.getColumns(vm, colName, cols,
                vm.getFieldMapping().getTable(), adapt);
            if (vinfo.isImplicitRelation())
              for (int i = 0; i < cols.length; i++)
                cols[i].setImplicitRelation(true);
            ColumnIO mappedIO = vinfo.getColumnIO();
            vm.setColumns(cols);
            vm.setColumnIO(mappedIO);
            if (mappedIO != null) {
                for (int i = 0; i < cols.length; i++) {
                    io.setInsertable(i, mappedIO.isInsertable(i, false));
                    io.setNullInsertable(i, mappedIO.isInsertable(i, true));
                    io.setUpdatable(i, mappedIO.isUpdatable(i, false));
                    io.setNullUpdatable(i, mappedIO.isUpdatable(i, true));
                }
            }
        }
        vm.mapConstraints(colName, adapt);
        return cols;
View Full Code Here


        if (log.isTraceEnabled())
            log.trace(_loc.get("strategy", this, _strategy.getAlias()));

        // mark columns as mapped
        Column[] cols = getColumns();
        ColumnIO io = getColumnIO();
        for (int i = 0; i < cols.length; i++) {
            if (io.isInsertable(i, false))
                cols[i].setFlag(Column.FLAG_DIRECT_INSERT, true);
            if (io.isUpdatable(i, false))
                cols[i].setFlag(Column.FLAG_DIRECT_UPDATE, true);
        }
    }
View Full Code Here

            && !col.getFlag(Column.FLAG_UNUPDATABLE)
            && !col.isNotNull()))
            return;

        if (_io == null)
            _io = new ColumnIO();
        _io.setInsertable(i, !col.getFlag(Column.FLAG_UNINSERTABLE));
        _io.setUpdatable(i, !col.getFlag(Column.FLAG_UNUPDATABLE));
        _io.setNullInsertable(i, !col.isNotNull());
        _io.setNullUpdatable(i, !col.isNotNull());
    }
View Full Code Here

    }

    public void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm)
        throws SQLException {
        Column[] cols = vers.getColumns();
        ColumnIO io = vers.getColumnIO();
        Object initial = nextVersion(null);
        for (int i = 0; i < cols.length; i++) {
            Row row = rm.getRow(cols[i].getTable(), Row.ACTION_INSERT, sm,
                    true);
            if (io.isInsertable(i, initial == null))
                row.setObject(cols[i], getColumnValue(initial, i));
        }
        // set initial version into state manager
        Object nextVersion;
        nextVersion = initial;
View Full Code Here

            if (getOrderColumnIO().isUpdatable(0, false))
                _orderCol.getColumn().setFlag(Column.FLAG_DIRECT_UPDATE, true);
        }
        if (_fk != null) {
            Column[] cols = _fk.getColumns();
            ColumnIO io = getJoinColumnIO();
            for (int i = 0; i < cols.length; i++) {
                if (io.isInsertable(i, false))
                    cols[i].setFlag(Column.FLAG_FK_INSERT, true);
                if (io.isUpdatable(i, false))
                    cols[i].setFlag(Column.FLAG_FK_UPDATE, true);
            }
        }

        _val.resolve(MODE_MAPPING);
View Full Code Here

        field.getKeyMapping().getValueInfo().assertNoSchemaComponents
            (field.getKey(), !adapt);
        field.getElementMapping().getValueInfo().assertNoSchemaComponents
            (field.getElement(), !adapt);

        _io = new ColumnIO();
        _cols = HandlerStrategies.map(field, field.getName(), _io, adapt);
        if (field.getValueStrategy() == ValueStrategies.AUTOASSIGN) {
            // first see if any columns already marked autoassign; if not mark
            // them all
            boolean marked = false;
View Full Code Here

        if (field.getMappedBy() != null)
            return;

        // if nullable, null any existing inverse columns that refer to this obj
        ValueMapping elem = field.getElementMapping();
        ColumnIO io = elem.getColumnIO();
        ForeignKey fk = elem.getForeignKey();
        if (!elem.getUseClassCriteria() && io.isAnyUpdatable(fk, true)) {
            assertInversable();
            Row row = rm.getAllRows(fk.getTable(), Row.ACTION_UPDATE);
            row.setForeignKey(fk, io, null);
            row.whereForeignKey(fk, sm);
            rm.flushAllRows(row);
View Full Code Here

        if (invsm == null)
            return;

        ValueMapping elem = field.getElementMapping();
        ForeignKey fk = elem.getForeignKey();
        ColumnIO io = elem.getColumnIO();
        Column order = field.getOrderColumn();

        int action;
        boolean writeable;
        boolean orderWriteable;
        if (invsm.isNew() && !invsm.isFlushed()) {
            // no need to null inverse columns of new instance
            if (sm == null || sm.isDeleted())
                return;
            writeable = io.isAnyInsertable(fk, false);
            orderWriteable = _orderInsert;
            action = Row.ACTION_INSERT;
        } else if (invsm.isDeleted()) {
            // no need to null inverse columns of deleted instance
            if (invsm.isFlushed() || sm == null || !sm.isDeleted())
                return;
            writeable = true;
            orderWriteable = false;
            action = Row.ACTION_DELETE;
        } else {
            if (sm != null && sm.isDeleted())
                sm = null;
            writeable = io.isAnyUpdatable(fk, sm == null);
            orderWriteable = field.getOrderColumnIO().isUpdatable
                (order, sm == null);
            action = Row.ACTION_UPDATE;
        }
        if (!writeable && !orderWriteable)
View Full Code Here

        if (log.isTraceEnabled())
            log.trace(_loc.get("strategy", this, _strategy.getAlias()));

        // mark columns as mapped
        Column[] cols = getColumns();
        ColumnIO io = getColumnIO();
        for (int i = 0; i < cols.length; i++) {
            if (io.isInsertable(i, false))
                cols[i].setFlag(Column.FLAG_DIRECT_INSERT, true);
            if (io.isUpdatable(i, false))
                cols[i].setFlag(Column.FLAG_DIRECT_UPDATE, true);
        }
    }
View Full Code Here

                OpenJPAStateManager keySm = RelationStrategies.
                    getStateManager(keyObj, store.getContext());
                // key is an entity
                ForeignKey fk = mapField.getKeyMapping().
                    getForeignKey();
                ColumnIO io = new ColumnIO();
                row.setForeignKey(fk, io, keySm);
            }
        } else {
            // key is an embeddable or basic type
            FieldStrategy strategy = mapField.getStrategy();
            if (strategy instanceof 
                    HandlerRelationMapTableFieldStrategy) {
                HandlerRelationMapTableFieldStrategy strat =
                    (HandlerRelationMapTableFieldStrategy) strategy;
                Column[] kcols = strat.getKeyColumns((ClassMapping)meta);
                ColumnIO kio = strat.getKeyColumnIO();
                HandlerStrategies.set(key, keyObj, store, row, kcols,
                        kio, true);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.jdbc.schema.ColumnIO

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.