Package org.apache.openjpa.jdbc.schema

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


    private void setNullIndicatorColumn(OpenJPAStateManager sm, Row row)
        throws SQLException {
        if (!_synthetic)
            return;

        Column col = field.getColumns()[0];
        Object val = ((EmbeddedClassStrategy) field.getEmbeddedMapping().
            getStrategy()).getNullIndicatorValue(sm);
        if (val == null)
            row.setNull(col, true);
        else
View Full Code Here


        VersionMappingInfo info = vers.getMappingInfo();
        info.assertNoJoin(vers, true);
        info.assertNoForeignKey(vers, !adapt);
        info.assertNoUnique(vers, false);

        Column tmplate = new Column();
        tmplate.setJavaType(getJavaType());
        tmplate.setName("versn");

        Column[] cols = info.getColumns(vers, new Column[]{ tmplate }, adapt);
        cols[0].setVersionStrategy(this);
        vers.setColumns(cols);
        vers.setColumnIO(info.getColumnIO());
View Full Code Here

        // based on the indexing of the columns in the table object -- the
        // same ordering we use when storing values and meta types. skip
        // updates when setting params for DELETEs; the updates are just there
        // to let us eval fk constraints
        int i = (getAction() == ACTION_DELETE) ? _cols.length: 0;
        Column col;
        Object val;
        int half = _vals.length / 2;
        for (; i < _vals.length; i++) {
            if (_vals[i] == null)
                continue;
View Full Code Here

        if (cols2 == null || cols2.size() != cols.size())
            return true;
        if (cols.size() != 1)
            return true;

        Column col;
        Column col2;
        for (int i = 0; i < cols.size(); i++) {
            col = cols.get(i);
            col2 = cols2.get(i);
            if (!StringUtils.equals(col.getName(), col2.getName()))
                return true;
            if (!StringUtils.equals(col.getTypeName(), col2.getTypeName()))
                return true;
            if (col.getSize() != col2.getSize())
                return true;
            if (col.getDecimalDigits() != col2.getDecimalDigits())
                return true;
            if (col.getFlag(Column.FLAG_UNINSERTABLE)
                != col2.getFlag(Column.FLAG_UNINSERTABLE))
                return true;
            if (col.getFlag(Column.FLAG_UNUPDATABLE)
                != col2.getFlag(Column.FLAG_UNUPDATABLE))
                return true;
        }
        return false;
    }
View Full Code Here

    /**
     * Create a new schema column with information from the given annotation.
     */
    private static Column newColumn(PrimaryKeyJoinColumn join) {
        Column col = new Column();
        col.setFlag(Column.FLAG_PK_JOIN, true);
        if (!StringUtils.isEmpty(join.name()))
            col.setName(join.name());
        if (!StringUtils.isEmpty(join.columnDefinition()))
            col.setName(join.columnDefinition());
        if (!StringUtils.isEmpty(join.referencedColumnName()))
            col.setTarget(join.referencedColumnName());
        return col;
    }
View Full Code Here

    /**
     * Parse @DiscriminatorColumn.
     */
    private void parseDiscriminatorColumn(ClassMapping cm,
        DiscriminatorColumn dcol) {
        Column col = new Column();
        if (!StringUtils.isEmpty(dcol.name()))
            col.setName(dcol.name());
        if (!StringUtils.isEmpty(dcol.columnDefinition()))
            col.setTypeName(dcol.columnDefinition());
        Discriminator discrim = cm.getDiscriminator();
        switch (dcol.discriminatorType()) {
            case CHAR:
                col.setJavaType(JavaTypes.CHAR);
                discrim.setJavaType(JavaTypes.CHAR);
                break;
            case INTEGER:
                col.setJavaType(JavaTypes.INT);
                if (dcol.length() != 31)
                    col.setSize(dcol.length());
                discrim.setJavaType(JavaTypes.INT);
                break;
            default:
                col.setJavaType(JavaTypes.STRING);
                col.setSize(dcol.length());
                discrim.setJavaType(JavaTypes.STRING);
        }
        cm.getDiscriminator().getMappingInfo().setColumns
            (Arrays.asList(new Column[]{ col }));
    }
View Full Code Here

    /**
     * Parse datastore identity information in @DataStoreIdColumn.
     */
    private void parseDataStoreIdColumn(ClassMapping cm, DataStoreIdColumn id) {
        Column col = new Column();
        if (!StringUtils.isEmpty(id.name()))
            col.setName(id.name());
        if (!StringUtils.isEmpty(id.columnDefinition()))
            col.setTypeName(id.columnDefinition());
        if (id.precision() != 0)
            col.setSize(id.precision());
        col.setFlag(Column.FLAG_UNINSERTABLE, !id.insertable());
        col.setFlag(Column.FLAG_UNUPDATABLE, !id.updatable());
        cm.getMappingInfo().setColumns(Arrays.asList(new Column[]{ col }));
    }
View Full Code Here

    /**
     * Create a new schema column with information from the given annotation.
     */
    private static Column newColumn(VersionColumn anno) {
        Column col = new Column();
        if (!StringUtils.isEmpty(anno.name()))
            col.setName(anno.name());
        if (!StringUtils.isEmpty(anno.columnDefinition()))
            col.setTypeName(anno.columnDefinition());
        if (anno.precision() != 0)
            col.setSize(anno.precision());
        else if (anno.length() != 255)
            col.setSize(anno.length());
        col.setNotNull(!anno.nullable());
        col.setDecimalDigits(anno.scale());
        col.setFlag(Column.FLAG_UNINSERTABLE, !anno.insertable());
        col.setFlag(Column.FLAG_UNUPDATABLE, !anno.updatable());
        return col;
    }
View Full Code Here

        }
    }

    @Override
    protected void parseLobMapping(FieldMetaData fmd) {
        Column col = new Column();
        if (fmd.getDeclaredTypeCode() == JavaTypes.STRING
            || fmd.getDeclaredType() == char[].class
            || fmd.getDeclaredType() == Character[].class)
            col.setType(Types.CLOB);
        else
            col.setType(Types.BLOB);
        ((FieldMapping) fmd).getValueInfo().setColumns(Arrays.asList
            (new Column[]{ col }));
    }
View Full Code Here

        // setup columns with cached lob and temporal info
        FieldMapping fm = (FieldMapping) field;
        if (_lob || _temporal != null) {
            if (_cols == null) {
                _cols = new ArrayList<Column>(1);
                _cols.add(new Column());
            }
            for (Column col : _cols) {
                if (_lob && (fm.getDeclaredTypeCode() == JavaTypes.STRING
                    || fm.getDeclaredType() == char[].class
                    || fm.getDeclaredType() == Character[].class)) {
View Full Code Here

TOP

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

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.