Package org.apache.openjpa.jdbc.meta

Examples of org.apache.openjpa.jdbc.meta.ValueMappingInfo


        FieldMapping field2 = (FieldMapping) orig;
        if (field.getMappingInfo().hasSchemaComponents()
            || field2.getMappingInfo().hasSchemaComponents())
            return true;

        ValueMappingInfo info = field.getValueInfo();
        List<Column> cols = (List<Column>) info.getColumns();
        if (cols == null || cols.size() == 0)
            return false;
        ValueMappingInfo info2 = field2.getValueInfo();
        List<Column> cols2 = (List<Column>) info2.getColumns();
        if (cols2 == null || cols2.size() != cols.size())
            return true;
        if (cols.size() != 1)
            return true;
View Full Code Here


    /**
     * Map the given value.
     */
    public static Column[] map(ValueMapping vm, String name, ColumnIO io,
        boolean adapt) {
        ValueMappingInfo vinfo = vm.getValueInfo();
        vinfo.assertNoJoin(vm, true);
        vinfo.assertNoForeignKey(vm, !adapt);

        Column[] cols = vm.getHandler().map(vm, name, io, adapt);
        if (cols.length > 0 && cols[0].getTable() == null) {
            cols = vinfo.getColumns(vm, name, cols,
                vm.getFieldMapping().getTable(), adapt);
            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));
View Full Code Here

    /**
     * Set unique data on the given mapping info.
     */
    private void parseUnique(FieldMapping fm,
        org.apache.openjpa.persistence.jdbc.Unique anno) {
        ValueMappingInfo info = fm.getValueInfo();
        if (!anno.enabled()) {
            info.setCanUnique(false);
            return;
        }

        org.apache.openjpa.jdbc.schema.Unique unq =
            new org.apache.openjpa.jdbc.schema.Unique();
        if (!StringUtils.isEmpty(anno.name()))
            unq.setName(anno.name());
        unq.setDeferred(anno.deferred());
        info.setUnique(unq);
    }
View Full Code Here

        else if (!StringUtils.isEmpty(anno.nullIndicatorColumnName()))
            nullInd = anno.nullIndicatorColumnName();
        if (nullInd == null)
            return;

        ValueMappingInfo info = fm.getValueInfo();
        populateNullIndicator(nullInd, info);
    }
View Full Code Here

        else if (!StringUtils.isEmpty(nullIndicatorColumn))
            nullInd = nullIndicatorColumn;
        if (nullInd == null)
            return;

        ValueMappingInfo info = vm.getValueInfo();
        populateNullIndicator(nullInd, info);
    }
View Full Code Here

    /**
     * Set unique data on the given mapping info.
     */
    private void parseUnique(FieldMapping fm,
        org.apache.openjpa.persistence.jdbc.Unique anno) {
        ValueMappingInfo info = fm.getValueInfo();
        if (!anno.enabled()) {
            info.setCanUnique(false);
            return;
        }

        org.apache.openjpa.jdbc.schema.Unique unq =
            new org.apache.openjpa.jdbc.schema.Unique();
        if (!StringUtils.isEmpty(anno.name()))
            unq.setName(anno.name());
        unq.setDeferred(anno.deferred());
        info.setUnique(unq);
    }
View Full Code Here

        else if (!StringUtils.isEmpty(anno.nullIndicatorColumnName()))
            nullInd = anno.nullIndicatorColumnName();
        if (nullInd == null)
            return;

        ValueMappingInfo info = fm.getValueInfo();
        populateNullIndicator(nullInd, info);
    }
View Full Code Here

        else if (!StringUtils.isEmpty(nullIndicatorColumn))
            nullInd = nullIndicatorColumn;
        if (nullInd == null)
            return;

        ValueMappingInfo info = vm.getValueInfo();
        populateNullIndicator(nullInd, info);
    }
View Full Code Here

        // around an inverse key: check to see if we're mapped as a secondary
        // table join but we're in the table of the related type, and if so
        // switch our join mapping info to our value mapping info
        String tableName = field.getMappingInfo().getTableName();
        Table table = field.getTypeMapping().getTable();
        ValueMappingInfo vinfo = field.getValueInfo();
        if (tableName != null && table != null
            && (tableName.equalsIgnoreCase(table.getName())
            || tableName.equalsIgnoreCase(table.getFullName()))) {
            vinfo.setJoinDirection(MappingInfo.JOIN_INVERSE);
            vinfo.setColumns(field.getMappingInfo().getColumns());
            field.getMappingInfo().setTableName(null);
            field.getMappingInfo().setColumns(null);
        }

        field.mapJoin(adapt, false);
        if (field.getTypeMapping().isMapped()) {
            ForeignKey fk = vinfo.getTypeJoin(field, field.getName(), true,
                adapt);
            field.setForeignKey(fk);
            field.setColumnIO(vinfo.getColumnIO());
            if (vinfo.getJoinDirection() == vinfo.JOIN_INVERSE)
                field.setJoinDirection(field.JOIN_INVERSE);
        } else
            RelationStrategies.mapRelationToUnmappedPC(field, field.getName(),
                adapt);
View Full Code Here

        // around an inverse key: check to see if we're mapped as a secondary
        // table join but we're in the table of the related type, and if so
        // switch our join mapping info to our value mapping info
        DBIdentifier tableName = field.getMappingInfo().getTableIdentifier();
        Table table = field.getTypeMapping().getTable();
        ValueMappingInfo vinfo = field.getValueInfo();
        if (!DBIdentifier.isNull(tableName) && table != null
            && (tableName.equals(table.getIdentifier())
            || tableName.equals(table.getFullIdentifier()))) {
            vinfo.setJoinDirection(MappingInfo.JOIN_INVERSE);
            vinfo.setColumns(field.getMappingInfo().getColumns());
            field.getMappingInfo().setTableIdentifier(DBIdentifier.NULL);
            field.getMappingInfo().setColumns(null);
        }
       
        if (!field.isBiMTo1JT())
            field.mapJoin(adapt, false);
        if (field.getTypeMapping().isMapped()) {
            if (field.getMappedByIdValue() != null)
                setMappedByIdColumns();           
            
            if (!field.isBiMTo1JT()) {
                ForeignKey fk = vinfo.getTypeJoin(field, field.getName(), true,
                    adapt);
                field.setForeignKey(fk);
            }
            field.setColumnIO(vinfo.getColumnIO());
            if (vinfo.getJoinDirection() == vinfo.JOIN_INVERSE)
                field.setJoinDirection(field.JOIN_INVERSE);
        } else
            RelationStrategies.mapRelationToUnmappedPC(field, field.getName(),
                adapt);
View Full Code Here

TOP

Related Classes of org.apache.openjpa.jdbc.meta.ValueMappingInfo

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.