Package org.apache.openjpa.jdbc.schema

Examples of org.apache.openjpa.jdbc.schema.PrimaryKey.addColumn()


        // add primary key columns to table pk if logical
        field.mapPrimaryKey(adapt);
        PrimaryKey pk = field.getTable().getPrimaryKey();
        if (field.isPrimaryKey() && pk != null && (adapt || pk.isLogical()))
            for (int i = 0; i < _cols.length; i++)
                pk.addColumn(_cols[i]);

        // set joinable
        if (!field.getHandler().objectValueRequiresLoad(field))
            for (int i = 0; i < _cols.length; i++)
                field.getDefiningMapping().setJoinable(_cols[i], this);
View Full Code Here


        PrimaryKey pk = field.getTable().getPrimaryKey();
        if (field.isPrimaryKey()) {
            Column[] cols = field.getColumns();
            if (pk != null && (adapt || pk.isLogical()))
                for (int i = 0; i < cols.length; i++)
                    pk.addColumn(cols[i]);
            for (int i = 0; i < cols.length; i++)
                field.getDefiningMapping().setJoinable(cols[i], this);
        }

        // map constraints after pk so we don't re-index / re-unique pk col
View Full Code Here

        PrimaryKey pk = field.getTable().getPrimaryKey();
        if (field.isPrimaryKey()) {
            Column[] cols = field.getColumns();
            if (pk != null && (adapt || pk.isLogical()))
                for (int i = 0; i < cols.length; i++)
                    pk.addColumn(cols[i]);
            for (int i = 0; i < cols.length; i++)
                field.getDefiningMapping().setJoinable(cols[i], this);
        }

        // map constraints after pk so we don't re-index / re-unique pk col
View Full Code Here

        Schema schema = group.addSchema(schemaName);

        Table table = schema.addTable(tableName);
        _pkColumn = addPrimaryKeyColumn(table);
        PrimaryKey pk = table.addPrimaryKey();
        pk.addColumn(_pkColumn);

        DBDictionary dict = _conf.getDBDictionaryInstance();
        _seqColumn = table.addColumn(dict.getValidColumnName
            (_seqColumnName, table));
        _seqColumn.setType(dict.getPreferredType(Types.BIGINT));
View Full Code Here

        PrimaryKey pk = field.getTable().getPrimaryKey();
        if (field.isPrimaryKey()) {
            Column[] cols = field.getColumns();
            if (pk != null && (adapt || pk.isLogical()))
                for (int i = 0; i < cols.length; i++)
                    pk.addColumn(cols[i]);
            for (int i = 0; i < cols.length; i++)
                field.getDefiningMapping().setJoinable(cols[i], this);
        }

        // map constraints after pk so we don't re-index / re-unique pk col
View Full Code Here

        Schema schema = group.addSchema(schemaName);

        Table table = schema.addTable(tableName);
        _pkColumn = addPrimaryKeyColumn(table);
        PrimaryKey pk = table.addPrimaryKey();
        pk.addColumn(_pkColumn);

        DBDictionary dict = _conf.getDBDictionaryInstance();
        _seqColumn = table.addColumn(dict.getValidColumnName
            (_seqColumnName, table));
        _seqColumn.setType(dict.getPreferredType(Types.BIGINT));
View Full Code Here

        // add primary key columns to table pk if logical
        field.mapPrimaryKey(adapt);
        PrimaryKey pk = field.getTable().getPrimaryKey();
        if (field.isPrimaryKey() && pk != null && (adapt || pk.isLogical()))
            for (int i = 0; i < _cols.length; i++)
                pk.addColumn(_cols[i]);

        // set joinable
        if (!field.getHandler().objectValueRequiresLoad(field))
            for (int i = 0; i < _cols.length; i++)
                field.getDefiningMapping().setJoinable(_cols[i], this);
View Full Code Here

        Column[] cols = fk.getColumns();
        Column[] pkCols = fk.getPrimaryKeyColumns();
        assertEquals(0, cols.length);
        assertEquals(0, pkCols.length);
        PrimaryKey pk = table2.addPrimaryKey("pk");
        pk.addColumn(c3);
        fk.join(c1, c3);
        pk.addColumn(c4);
        fk.join(c2, c4);
        cols = fk.getColumns();
        pkCols = fk.getPrimaryKeyColumns();
View Full Code Here

        assertEquals(0, cols.length);
        assertEquals(0, pkCols.length);
        PrimaryKey pk = table2.addPrimaryKey("pk");
        pk.addColumn(c3);
        fk.join(c1, c3);
        pk.addColumn(c4);
        fk.join(c2, c4);
        cols = fk.getColumns();
        pkCols = fk.getPrimaryKeyColumns();
        assertEquals(2, cols.length);
        assertEquals(c1, cols[0]);
View Full Code Here

        Column c2 = table.addColumn("c2");
        Table table2 = _schema.addTable("table2");
        Column c3 = table2.addColumn("c3");
        Column c4 = table2.addColumn("c4");
        PrimaryKey pk = table2.addPrimaryKey("pk");
        pk.addColumn(c3);
        pk.addColumn(c4);
        ForeignKey fk = table.addForeignKey("fk");
        fk.join(c1, c3);
        fk.join(c2, c4);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.