Package org.apache.openjpa.jdbc.schema

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


        if (schemaName.length() == 0)
            schemaName = Schemas.getNewTableSchema(_conf);

        // build the sequence in one of the designated schemas
        SchemaGroup group = new SchemaGroup();
        Schema schema = group.addSchema(schemaName);

        _seq = schema.addSequence(seqName);
        _seq.setInitialValue(_initial);
        _seq.setIncrement(_increment);
        _seq.setAllocate(_allocate);
    }
View Full Code Here


                schemaName = Schemas.getNewTableSchema(_conf);
            if (schemaName == null)
                schemaName = schemas[i].getName();

            // create table in this group
            Schema schema = group.getSchema(schemaName);
            if (schema == null)
                schema = group.addSchema(schemaName);
           
            Table copy = schema.importTable(_pkColumn.getTable());
            // importTable() does not import unique constraints
            Unique[] uniques = _pkColumn.getTable().getUniques();
            for (Unique u : uniques) {
              copy.importUnique(u);
            }
View Full Code Here

        String schemaName = Strings.getPackageName(_table);
        if (schemaName.length() == 0)
            schemaName = Schemas.getNewTableSchema(_conf);

        SchemaGroup group = new SchemaGroup();
        Schema schema = group.addSchema(schemaName);

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

        DBDictionary dict = _conf.getDBDictionaryInstance();
View Full Code Here

        String schemaName = Strings.getPackageName(_seqName);
        if (schemaName.length() == 0)
            schemaName = Schemas.getNewTableSchema(_conf);

        // create table in this group
        Schema schema = group.getSchema(schemaName);
        if (schema == null)
            schema = group.addSchema(schemaName);
        schema.importSequence(_seq);
    }
View Full Code Here

        if (schemaName.length() == 0)
            schemaName = Schemas.getNewTableSchema(_conf);

        // build the sequence in one of the designated schemas
        SchemaGroup group = new SchemaGroup();
        Schema schema = group.addSchema(schemaName);

        _seq = schema.addSequence(seqName);
        _seq.setInitialValue(_initial);
        _seq.setIncrement(_increment);
        _seq.setAllocate(_allocate);
    }
View Full Code Here

    public void testSchemaGroup() {
        SchemaGroup group = _schema.getSchemaGroup();
        assertEquals(_schema, group.getSchema("schema"));
        Table foo1 = _schema.addTable("foo");

        Schema schema2 = group.addSchema("schema2");
        assertNull(schema2.getTable("foo"));
        Table foo2 = schema2.addTable("foo");
        assertEquals(foo2, schema2.getTable("foo"));
        assertEquals(foo1, _schema.getTable("foo"));

        assertEquals(foo1, group.findTable("schema.foo"));
        assertEquals(foo2, group.findTable("schema2.foo"));
    }
View Full Code Here

   
    /**
     * Checks the pased sequences.
     */
    public void testSequenceParsing() {
        Schema schema = _group.getSchema("SCHEMA1");
        assertEquals(2, schema.getSequences().length);
        assertEquals(0, _group.getSchema("SCHEMA2").getSequences().length);
       
        Sequence seq1 = schema.getSequence("SEQ1");
        assertNotNull(seq1);
        assertEquals("SEQ1", seq1.getName());
        assertEquals(seq1, _group.findSequence("SEQ1"));
        assertEquals(seq1, _group.findSequence("SCHEMA1.SEQ1"));
        assertEquals(1, seq1.getInitialValue());
        assertEquals(1, seq1.getIncrement());
        assertEquals(0, seq1.getAllocate());
       
        Sequence seq2 = schema.getSequence("SEQ2");
        assertNotNull(seq2);
        assertEquals(3, seq2.getInitialValue());
        assertEquals(5, seq2.getIncrement());
        assertEquals(50, seq2.getAllocate());
    }
View Full Code Here

   
    /**
     * Checks table and column parsing.
     */
    public void testTableColumnParsing() {
        Schema schema1 = _group.getSchema("SCHEMA1");
        Table[] tables = schema1.getTables();
        assertEquals(2, tables.length);
        assertEquals("TABLE1", tables[0].getName());
        assertEquals("TABLE3", tables[1].getName());
       
        Column[] cols = tables[0].getColumns();
View Full Code Here

        String schemaName = Strings.getPackageName(_seqName);
        if (schemaName.length() == 0)
            schemaName = Schemas.getNewTableSchema(_conf);

        // create table in this group
        Schema schema = group.getSchema(schemaName);
        if (schema == null)
            schema = group.addSchema(schemaName);
        schema.importSequence(_seq);
    }
View Full Code Here

        if (schemaName.length() == 0)
            schemaName = Schemas.getNewTableSchema(_conf);

        // build the sequence in one of the designated schemas
        SchemaGroup group = new SchemaGroup();
        Schema schema = group.addSchema(schemaName);

        _seq = schema.addSequence(seqName);
        _seq.setInitialValue(_initial);
        _seq.setIncrement(_increment);
        _seq.setAllocate(_allocate);
    }
View Full Code Here

TOP

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

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.