Package org.apache.openjpa.jdbc.identifier

Examples of org.apache.openjpa.jdbc.identifier.DBIdentifier


     *
     * @param class
     *            mapping to get the schema name
     */
    public DBIdentifier resolveTableIdentifier(ClassMapping mapping, Table table) {
        DBIdentifier sName = mapping.getTable().getSchemaIdentifier();
        DBIdentifier tableName = DBIdentifier.NULL;
        if (DBIdentifier.isNull(sName)) {
            tableName = table.getFullIdentifier();
        } else if (!DBIdentifier.isNull(table.getSchemaIdentifier())) {
            tableName = table.getFullIdentifier();
        } else {
View Full Code Here


        // order is important in this method; start with columns
        Table[] tabs;
        Table dbTable;
        Column[] cols;
        Column col;
        DBIdentifier defaultSchemaName = DBIdentifier.newSchema(_dict.getDefaultSchemaName());
        for (int i = 0; i < schemas.length; i++) {
            tabs = schemas[i].getTables();
            for (int j = 0; j < tabs.length; j++) {
                cols = tabs[j].getColumns();
                dbTable = db.findTable(schemas[i], tabs[j].getQualifiedPath(), defaultSchemaName);
                for (int k = 0; k < cols.length; k++) {
                    if (dbTable != null) {
                        DBIdentifier colName = cols[k].getIdentifier();
                        col = dbTable.getColumn(colName);
                        if (col == null) {
                            if (addColumn(cols[k]))
                                dbTable.importColumn(cols[k]);
                            else
View Full Code Here

                    tabs = schemas[i].getTables();
                    for (int j = 0; j < tabs.length; j++) {
                        if (DBIdentifier.isNull(tabs[j].getSchemaIdentifier())) {
                            tables.add(tabs[j].getIdentifier());
                        } else {
                            DBIdentifier sName = tabs[j].getFullIdentifier();
                            tables.add(sName);
                        }
                    }
                }
                if (!tables.isEmpty())
View Full Code Here

        // sequence already exists?
        QualifiedDBIdentifier path = QualifiedDBIdentifier.getPath(_seqName);
        if (group.isKnownSequence(path))
            return;

        DBIdentifier schemaName = getSchemaIdentifier();
        if (DBIdentifier.isEmpty(schemaName)) {
            schemaName = path.getSchemaName();
            if (DBIdentifier.isEmpty(schemaName))
                schemaName = Schemas.getNewTableSchemaIdentifier(_conf);
        }
View Full Code Here

    /**
     * Creates the sequence object.
     */
    private void buildSequence() {
        QualifiedDBIdentifier path = QualifiedDBIdentifier.getPath(_seqName);
        DBIdentifier seqName = path.getIdentifier();
        // JPA 2 added schema as a configurable attribute on 
        // sequence generator.  OpenJPA <= 1.x allowed this via
        // schema.sequence on the sequence name.  Specifying a schema
        // name on the annotation or in the orm will override the old
        // behavior.
        DBIdentifier schemaName = _schema;
        if (DBIdentifier.isEmpty(schemaName)) {
            schemaName = path.getSchemaName();
            if (DBIdentifier.isEmpty(schemaName))
                schemaName = Schemas.getNewTableSchemaIdentifier(_conf);
        }
View Full Code Here

    }

    public DBIdentifier loadIdentifierFromDB(DBDictionary dbdict, Connection conn) {
        if( isLogical() || getTable() == null)
            return DBIdentifier.NULL;
        DBIdentifier retVal = DBIdentifier.NULL;
        try{
            Schema schema = getTable().getSchema();
            ForeignKey[] fks = dbdict.getImportedKeys(conn.getMetaData(),
                DBIdentifier.newCatalog(conn.getCatalog()), schema.getIdentifier(),
                getTable().getIdentifier(), conn, false);
View Full Code Here

    public boolean containsColumn(DBIdentifier name, DBDictionary dict) {
        if (DBIdentifier.isNull(name) || _colMap == null) {
            return false;
        }
        DBIdentifier sName = DBIdentifier.toUpper(name);
        return _colMap.containsKey(sName);
    }
View Full Code Here

        DBIdentifier sName = DBIdentifier.toUpper(name);
        return _colMap.containsKey(sName);
    }

    public boolean containsColumn(Column col) {
        DBIdentifier colName = col.getIdentifier();
        if (DBIdentifier.isNull(colName) || _colMap == null) {
            return false;
        }
        DBIdentifier sName = DBIdentifier.toUpper(colName);
        Collection<Column> coll = _colMap.values();
        for (Column column : coll) {
            if (column.getIdentifier().equals(sName))
                return true;
        }
View Full Code Here

        } else {
            col = new Column(name, this);
        }
        if (_colMap == null)
            _colMap = new LinkedHashMap<DBIdentifier, Column>();
        DBIdentifier sName = DBIdentifier.toUpper(name);
        _colMap.put(sName, col);
        _cols = null;
        return col;
    }
View Full Code Here

            col = schema.getSchemaGroup().newColumn(validName, this);
        else
            col = new Column(validName, this);
        if (_colMap == null)
            _colMap = new LinkedHashMap<DBIdentifier, Column>();
        DBIdentifier sName = DBIdentifier.toUpper(name);
        _colMap.put(sName, col);
        _cols = null;
        return col;
    }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.jdbc.identifier.DBIdentifier

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.