Package org.apache.openjpa.jdbc.schema

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


        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


            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

    protected String generateSQL(DBDictionary dict) {
        try {
            if (_fks != null) {
                ForeignKey[] fks = getTable().getForeignKeys();
                ColumnIO io;
                for (int i = 0; i < _fks.length; i++) {
                    if (_fks[i] != null) {
                        io = (_fkIO == null) ? null : _fkIO[i];
                        super.setForeignKey(fks[i], io, _fks[i]);
                    }
View Full Code Here

                super.setPrimaryKey(_pkIO, _pk);
            if ((flags & PK_WHERE) > 0)
                super.wherePrimaryKey(_pk);
            if (_fkSet != null) {
                ForeignKey[] fks = getTable().getForeignKeys();
                ColumnIO io;
                for (int i = 0; i < _fkSet.length; i++) {
                    if (_fkSet[i] != null) {
                        io = (_fkIO == null) ? null : _fkIO[i];
                        super.setForeignKey(fks[i], io, _fkSet[i]);
                    }
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

            { tmplate }) && given == null)
            return null;

        if (given != null && (given.getFlag(Column.FLAG_UNINSERTABLE)
            || given.getFlag(Column.FLAG_UNUPDATABLE))) {
            ColumnIO io = new ColumnIO();
            io.setInsertable(0, !given.getFlag(Column.FLAG_UNINSERTABLE));
            io.setUpdatable(0, !given.getFlag(Column.FLAG_UNUPDATABLE));
            setColumnIO(io);
        }

        if (given != null && !DBIdentifier.isNull(given.getIdentifier())) {
            // test if given column name is actually a field name, in which
View Full Code Here

        if (!def.populateOrderColumns(field, table, new Column[]{ tmplate })
            && _orderCol == null)
            return null;

        if (_orderCol != null) {
            ColumnIO io = new ColumnIO();
            io.setNullInsertable(0, !_orderCol.isNotNull());
            io.setNullUpdatable(0, !_orderCol.isNotNull());
            io.setInsertable(0, !_orderCol.getFlag(Column.FLAG_UNINSERTABLE));
            io.setUpdatable(0, !_orderCol.getFlag(Column.FLAG_UNUPDATABLE));
            setColumnIO(io);
        }

        return mergeColumn(field, "order", tmplate, true, _orderCol, table,
            adapt, def.defaultMissingInfo());
View Full Code Here

        // gather columns and result arguments
        FieldMapping[] fms = vm.getEmbeddedMapping().getFieldMappings();
        Column[] curCols;
        Object[] curArgs;
        ColumnIO curIO;
        for (int i = 0; i < fms.length; i++) {
            if (fms[i].getManagement() != FieldMapping.MANAGE_PERSISTENT)
                continue;
            FieldStrategy strat = fms[i].getStrategy();
           
            if (!(strat instanceof Embeddable))
                throw new MetaDataException(_loc.get("not-embeddable",
                    vm, fms[i]));
           
            ValueMapping val = fms[i].getValueMapping();
            if (val.getEmbeddedMapping() != null)
                map(val, name, io, adapt, cols, args);
           
            curCols = ((Embeddable) strat).getColumns();
            curIO = ((Embeddable) strat).getColumnIO();
            for (int j = 0; j < curCols.length; j++) {
                io.setInsertable(cols.size(), curIO.isInsertable(j, false));
                io.setNullInsertable(cols.size(),
                    curIO.isInsertable(j, true));
                io.setUpdatable(cols.size(), curIO.isUpdatable(j, false));
                io.setNullUpdatable(cols.size(), curIO.isUpdatable(j, true));
                cols.add(curCols[j]);
            }

            curArgs = ((Embeddable) fms[i].getStrategy()).getResultArguments();
            if (curCols.length == 1)
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.