Package org.datanucleus.store.mapped

Examples of org.datanucleus.store.mapped.DatastoreIdentifier


                                            break;
                                        }
                                    }
                                }

                                DatastoreIdentifier secTableIdentifier =
                                    storeMgr.getIdentifierFactory().newDatastoreContainerIdentifier(mmd.getTable());
                                // Use specified catalog, else take catalog of the owning table
                                String catalogName = mmd.getCatalog();
                                if (catalogName == null)
                                {
                                    catalogName = getCatalogName();
                                }
                                // Use specified schema, else take schema of the owning table
                                String schemaName = mmd.getSchema();
                                if (schemaName == null)
                                {
                                    schemaName = getSchemaName();
                                }
                                secTableIdentifier.setCatalogName(catalogName);
                                secTableIdentifier.setSchemaName(schemaName);

                                secTable = new SecondaryTable(secTableIdentifier, storeMgr, this, joinmd, clr);
                                secTable.preInitialize(clr);
                                secTable.initialize(clr);
                                secTable.postInitialize(clr);
View Full Code Here


                if (colmd.getJdbcType().equals("VARCHAR") && colmd.getLength() == null)
                {
                    colmd.setLength(storeMgr.getIntProperty("datanucleus.rdbms.stringDefaultLength"));
                }
                IdentifierFactory idFactory = getStoreManager().getIdentifierFactory();
                DatastoreIdentifier colIdentifier = idFactory.newIdentifier(IdentifierType.COLUMN, colmd.getName());
                Column col = (Column)addDatastoreField(null, colIdentifier, null, colmd);
                SQLTypeInfo sqlTypeInfo = storeMgr.getSQLTypeInfoForJDBCType(
                    JDBCUtils.getJDBCTypeForName(colmd.getJdbcType()));
                col.setTypeInfo(sqlTypeInfo);
View Full Code Here

                                    {
                                        throw new NucleusUserException(LOCALISER.msg("057035",
                                            ((Column)refDatastoreMapping.getDatastoreField()).getIdentifier(), toString())).setFatal();
                                    }

                                    DatastoreIdentifier identifier = null;
                                    IdentifierFactory idFactory = storeMgr.getIdentifierFactory();
                                    if (colmd.getName() == null || colmd.getName().length() < 1)
                                    {
                                        // No user provided name so generate one
                                        identifier = idFactory.newForeignKeyFieldIdentifier(ownerFmd,
View Full Code Here

        // a). Columns specified directly
        if (colmds != null && colmds.length > 0)
        {
            for (int i=0;i<colmds.length;i++)
            {
                DatastoreIdentifier colName = storeMgr.getIdentifierFactory().newDatastoreFieldIdentifier(colmds[i].getName());
                Column col = columnsByName.get(colName);
                if (col == null)
                {
                    NucleusLogger.DATASTORE.warn(LOCALISER.msg("058001", toString(), index.getName(),
                        colmds[i].getName()));
View Full Code Here

        {
            // Can't create a FK if we don't know where it goes to
            NucleusLogger.DATASTORE_SCHEMA.warn(LOCALISER.msg("058105", acmd.getFullClassName()));
            return null;
        }
        DatastoreIdentifier tableId = storeMgr.getIdentifierFactory().newDatastoreContainerIdentifier(fkmd.getTable());
        ClassTable refTable = (ClassTable)storeMgr.getDatastoreClass(tableId);
        if (refTable == null)
        {
            // TODO Go to the datastore and query for this table to get the columns of the PK
            NucleusLogger.DATASTORE_SCHEMA.warn(LOCALISER.msg("058106", acmd.getFullClassName(),
                fkmd.getTable()));
            return null;
        }
        PrimaryKey pk = refTable.getPrimaryKey();
        List targetCols = pk.getColumns();

        // Generate the columns for the source of the foreign-key
        List sourceCols = new ArrayList();
        ColumnMetaData[] colmds = fkmd.getColumnMetaData();
        AbstractMemberMetaData[] fmds = fkmd.getMemberMetaData();
        if (colmds != null && colmds.length > 0)
        {
            // FK specified via <column>
            for (int i=0;i<colmds.length;i++)
            {
                // Find the column and add to the source columns for the FK
                DatastoreIdentifier colId = storeMgr.getIdentifierFactory().newDatastoreFieldIdentifier(colmds[i].getName());
                Column sourceCol = columnsByName.get(colId);
                if (sourceCol == null)
                {
                    NucleusLogger.DATASTORE_SCHEMA.warn(LOCALISER.msg("058107",
                        acmd.getFullClassName(), fkmd.getTable(), colmds[i].getName(), toString()));
View Full Code Here

        // a). Columns specified directly
        if (colmds != null && colmds.length > 0)
        {
            for (int i=0;i<colmds.length;i++)
            {
                DatastoreIdentifier colName = storeMgr.getIdentifierFactory().newDatastoreFieldIdentifier(colmds[i].getName());
                Column col = columnsByName.get(colName);
                if (col == null)
                {
                    NucleusLogger.DATASTORE.warn(LOCALISER.msg("058202",
                        toString(), ck.getName(), colmds[i].getName()));
View Full Code Here

        IdentifierFactory idFactory = storeMgr.getIdentifierFactory();

        Iterator<CandidateKey> cks = candidateKeysByMapField.values().iterator();
        while (cks.hasNext())
        {
            DatastoreIdentifier ckName = idFactory.newCandidateKeyIdentifier(this, ++ckNum);
            CandidateKey ck = cks.next();
            ck.setName(ckName.getIdentifierName());

            String ckSql = dba.getAddCandidateKeyStatement(ck, idFactory);
            if (ckSql != null)
            {
                stmts.add(ckSql);
View Full Code Here

        JavaTypeMapping indexMapping = new IndexMapping();
        indexMapping.initialize(storeMgr, indexType.getName());
        indexMapping.setMemberMetaData(mmd);
        indexMapping.setDatastoreContainer(this);
        IdentifierFactory idFactory = storeMgr.getIdentifierFactory();
        DatastoreIdentifier indexColumnName = null;
        ColumnMetaData colmd = null;

        // Allow for any user definition in OrderMetaData
        OrderMetaData omd = mmd.getOrderMetaData();
        if (omd != null)
View Full Code Here

            colmd = mmd.getOrderMetaData().getColumnMetaData()[0];
        }
        else
        {
            // No column name so use default
            DatastoreIdentifier id = storeMgr.getIdentifierFactory().newIndexFieldIdentifier(mmd);
            colmd = new ColumnMetaData();
            colmd.setName(id.getIdentifierName());
        }
        orderMapping = storeMgr.getMappingManager().getMapping(int.class); // JDO2 spec [18.5] order column is assumed to be "int"
        ColumnCreator.createIndexColumn(orderMapping, storeMgr, clr, this, colmd, pkRequired && !pkColsSpecified);
        if (NucleusLogger.DATASTORE.isDebugEnabled())
        {
View Full Code Here

        HashMap unvalidated = new HashMap(columnsByName);
        Iterator i = storeMgr.getColumnInfoForTable(this, conn).iterator();
        while (i.hasNext())
        {
            RDBMSColumnInfo ci = (RDBMSColumnInfo)i.next();
            DatastoreIdentifier colName = storeMgr.getIdentifierFactory().newIdentifier(IdentifierType.COLUMN, ci.getColumnName());
            Column col = (Column)unvalidated.get(colName);
            if (col == null)
            {
                if (!hasColumnName(colName))
                {
                    throw new UnexpectedColumnException(this.toString(),colName.getIdentifierName(), this.getSchemaName(), this.getCatalogName());
                }
                /*
                 * Otherwise it's a duplicate column name in the
                 * metadata and we ignore it.  Cloudscape is known to
View Full Code Here

TOP

Related Classes of org.datanucleus.store.mapped.DatastoreIdentifier

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.