Package org.apache.openjpa.jdbc.schema

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


        throws SQLException {
        if (field.getUseClassCriteria())
            return;

        ForeignKey fk = field.getForeignKey();
        ColumnIO io = field.getColumnIO();
        if (!io.isAnyUpdatable(fk, true))
            return;

        // null inverse if not already enforced by fk
        if (field.getIndependentTypeMappings().length != 1)
            throw RelationStrategies.uninversable(field);
View Full Code Here


        throws SQLException {
        if (rel == null)
            return;

        ForeignKey fk = field.getForeignKey();
        ColumnIO io = field.getColumnIO();

        int action;
        if (rel.isNew() && !rel.isFlushed()) {
            if (sm.isDeleted() || !io.isAnyInsertable(fk, false))
                return;
            action = Row.ACTION_INSERT;
        } else if (rel.isDeleted()) {
            if (rel.isFlushed() || !sm.isDeleted())
                return;
            action = Row.ACTION_DELETE;
        } else {
            if (sm.isDeleted())
                sm = null;
            if (!io.isAnyUpdatable(fk, sm == null))
                return;
            action = Row.ACTION_UPDATE;
        }

        if (field.getIndependentTypeMappings().length != 1)
View Full Code Here

        throws SQLException {
        if (field.getUseClassCriteria())
            return;

        ForeignKey fk = field.getForeignKey();
        ColumnIO io = field.getColumnIO();
        if (!io.isAnyUpdatable(fk, true))
            return;

        // null inverse if not already enforced by fk
        if (field.getIndependentTypeMappings().length != 1)
            throw RelationStrategies.uninversable(field);
View Full Code Here

        throws SQLException {
        if (rel == null)
            return;

        ForeignKey fk = field.getForeignKey();
        ColumnIO io = field.getColumnIO();

        int action;
        if (rel.isNew() && !rel.isFlushed()) {
            if (sm.isDeleted() || !io.isAnyInsertable(fk, false))
                return;
            action = Row.ACTION_INSERT;
        } else if (rel.isDeleted()) {
            if (rel.isFlushed() || !sm.isDeleted())
                return;
            action = Row.ACTION_DELETE;
        } else {
            if (sm.isDeleted())
                sm = null;
            if (!io.isAnyUpdatable(fk, sm == null))
                return;
            action = Row.ACTION_UPDATE;
        }

        if (field.getIndependentTypeMappings().length != 1)
View Full Code Here

        for (int i = 0; i < fms.length; i++)
            fms[i].resolve(MODE_MAPPING);

        // mark mapped columns
        if (_cols != null) {
            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);
            }
        }
        // once columns are resolved, resolve unique constraints as they need
        // the columns be resolved
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

            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

            insertFlag = Column.FLAG_FK_INSERT;
        } else {
            cols = getColumns();
            insertFlag = Column.FLAG_DIRECT_INSERT;
        }
        ColumnIO io = getColumnIO();
        for (int i = 0; i < cols.length; i++) {
            if (io.isInsertable(i, false))
                cols[i].setFlag(insertFlag, true);
            if (io.isUpdatable(i, false))
                cols[i].setFlag(insertFlag, true);
        }
    }
View Full Code Here

    /**
     * Return the column I/O information, creating it if necessary.
     */
    private ColumnIO newIO() {
        if (_io == null)
            _io = new ColumnIO();
        return _io;
    }
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

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.