Package org.apache.openjpa.jdbc.schema

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


                        throw new UserException(_loc.get(
                                "unique-missing-column",
                                new Object[]{cm, columnName, tableName,
                                Arrays.toString(table.getColumnNames())}));
              }
                    Column uniqueColumn = table.getColumn(columnName);
              uniqueColumns[i] = uniqueColumn;
            }
            Unique unique = createUnique(cm, "unique", template, 
                uniqueColumns, adapt);
            if (unique != null)
View Full Code Here


        vinfo.assertNoIndex(field, !adapt);

        // before we map the null indicator column, we need to make sure our
        // value is mapped so we can tell whether the column is synthetic
        field.getValueMapping().resolve(field.MODE_META | field.MODE_MAPPING);
        Column col = vinfo.getNullIndicatorColumn(field, field.getName(),
            field.getTable(), adapt);
        if (col != null) {
            field.setColumns(new Column[]{ col });
            field.setColumnIO(vinfo.getColumnIO());
        }
View Full Code Here

        if (cols.length != 1)
            _synthetic = false;
        else {
            // do any of the embedded field mappings use this column?
            // if not, consider it synthetic
            Column col = cols[0];
            boolean found = false;
            FieldMapping[] fields = field.getEmbeddedMapping().
                getFieldMappings();
            for (int i = 0; !found && i < fields.length; i++) {
                cols = fields[i].getColumns();
View Full Code Here

    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

            ClassMetaData ownerMeta = ownerSm.getMetaData();
            // loop through all the fields in the owner entity
            for (FieldMetaData ownerFM : ownerMeta.getFields()) {
                // look for any single column in this field references the
                // same column as the foreign key target column
                Column cols[] = ((FieldMapping) ownerFM).getColumns();
                if (cols.length == 1            // only support attribute of non-compound foreign key
                        && cols != ownerCols    // not @Id field
                        && cols[0].getIdentifier().equals(ownerCols[0].getIdentifier())) {
                    // copy the foreign key value to the current field.
                    FieldMetaData inverseFM = inverseSm.getMetaData().getField(
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 (!StringUtils.isEmpty(temp))
            _mapKeyTemporal = Enum.valueOf(TemporalType.class, temp);
        FieldMapping fm = (FieldMapping) currentElement();
        List<Column> cols = fm.getKeyMapping().getValueInfo().getColumns();
        if (cols.isEmpty()) {
            cols = Arrays.asList(new Column[]{ new Column() });
            fm.getKeyMapping().getValueInfo().setColumns(cols);
        }

        Column col = (Column) cols.get(0);
        switch (_mapKeyTemporal) {
            case DATE:
                col.setType(Types.DATE);
                break;
            case TIME:
                col.setType(Types.TIME);
                break;
            case TIMESTAMP:
                col.setType(Types.TIMESTAMP);
                break;
        }
    }
View Full Code Here

            int typeCode = fm.isElementCollection() ? fm.getElement().getDeclaredTypeCode() :
                fm.getDeclaredTypeCode();
            Class<?> type = fm.isElementCollection() ? fm.getElement().getDeclaredType() : fm.getDeclaredType()
            if (_cols == null) {
                _cols = new ArrayList<Column>(1);
                _cols.add(new Column());
            }
            for (Column col : _cols) {
                if (_lob && (typeCode == JavaTypes.STRING
                    || type == char[].class
                    || type == Character[].class)) {
View Full Code Here

    /**
     * Parse primary-key-join-column.
     */
    private boolean startPrimaryKeyJoinColumn(Attributes attrs)
        throws SAXException {
        Column col = parseColumn(attrs);
        col.setFlag(Column.FLAG_PK_JOIN, true);
        // pk join columns on fields act as field cols
        if (currentElement() instanceof FieldMapping) {
            if (_cols == null)
                _cols = new ArrayList<Column>(3);
            _cols.add(col);
View Full Code Here

        // only join cols in a join table join field table to class table;
        // others act as data fk cols
        Object currentParent = currentParent();
        if (currentParent == COLLECTION_TABLE) {
            FieldMapping fm = (FieldMapping) peekElement();
            Column col = parseColumn(attrs);
            List<Column> colList = fm.getMappingInfo().getColumns();
            if (colList.isEmpty()) {
                colList = new ArrayList<Column>();
                fm.getMappingInfo().setColumns(colList);
            }
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.