Examples of DatastoreField


Examples of org.jpox.store.mapped.DatastoreField

        if (fmd.getKeyMetaData() != null && fmd.getKeyMetaData().getColumnMetaData() != null &&
            fmd.getKeyMetaData().getColumnMetaData().length > 0)
        {
            colmd = fmd.getKeyMetaData().getColumnMetaData()[0];
        }
        DatastoreField col = mmgr.createDatastoreField(this, getType(), colmd);
        mmgr.createDatastoreMapping(this, fmd, 0, datastoreContainer.getStoreManager(), col);
    }
View Full Code Here

Examples of org.jpox.store.mapped.DatastoreField

                        refDatastoreMapping.getDatastoreField().getIdentifier(), toString())).setFatal();
                }

                // Create a Datastore field to equate to the referenced classes datastore field
                MappingManager mmgr = datastoreContainer.getStoreManager().getMappingManager();
                DatastoreField col = mmgr.createDatastoreField(fmd, datastoreContainer, mapping,
                    colmd, refDatastoreMapping.getDatastoreField(), clr);

                // Add its datastore mapping
                DatastoreMapping datastoreMapping = mmgr.createDatastoreMapping(mapping, storeMgr, col,
                    refDatastoreMapping.getJavaTypeMapping().getJavaTypeForDatastoreMapping(i));
View Full Code Here

Examples of org.jpox.store.mapped.DatastoreField

            // Loop through each id column in the reference table and add the same here
            // applying the required names from the columnContainer
            for (int j=0; j<mapping.getNumberOfDatastoreFields(); j++)
            {
                JavaTypeMapping m = masterMapping;
                DatastoreField refColumn = mapping.getDataStoreMapping(j).getDatastoreField();
                if (mapping instanceof PersistenceCapableMapping)
                {
                    m = dba.getMapping(clr.classForName(refColumn.getMapping().getType()), storeMgr);
                    ((PersistenceCapableMapping)masterMapping).addJavaTypeMapping(m);
                }

                ColumnMetaData userdefinedColumn = null;
                if (userdefinedCols != null)
                {
                    for (int k=0;k<userdefinedCols.length;k++)
                    {
                        if (refColumn.getIdentifier().toString().equals(userdefinedCols[k].getTarget()))
                        {
                            userdefinedColumn = userdefinedCols[k];
                            break;
                        }
                    }
                    if (userdefinedColumn == null && nextUserdefinedCol < userdefinedCols.length)
                    {
                        userdefinedColumn = userdefinedCols[nextUserdefinedCol++];
                    }
                }

                // Add this application identity column
                DatastoreField idColumn = null;
                if (userdefinedColumn != null)
                {
                    // User has provided a name for this column
                    // Currently we only use the column namings from the users definition but we could easily
                    // take more of their details.
                    idColumn = addDatastoreField(refColumn.getStoredJavaType(),
                        storeMgr.getIdentifierFactory().newIdentifier(IdentifierFactory.COLUMN, userdefinedColumn.getName()),
                        m, refColumn.getMetaData());
                }
                else
                {
                    // No name provided so take same as superclass
                    idColumn = addDatastoreField(refColumn.getStoredJavaType(), refColumn.getIdentifier(),
                        m, refColumn.getMetaData());
                }
                if (mapping != null && mapping.getDataStoreMapping(j).getDatastoreField().getMetaData() != null)
                {
                    refColumn.copyConfigurationTo(idColumn);
                }
                idColumn.setAsPrimaryKey();

                // Set the column type based on the field.getType()
                getStoreManager().getMappingManager().createDatastoreMapping(m, storeMgr, idColumn,
                    refColumn.getMapping().getType());
            }
View Full Code Here

Examples of org.jpox.store.mapped.DatastoreField

    getStoreManager().getMappingManager().createDatastoreMapping(sequenceNameMapping, storeMgr, colSequenceName,
            String.class.getName());

        // "NEXT_VAL" column
        nextValMapping = dba.getMapping(Long.class, storeMgr);
        DatastoreField colNextVal=addDatastoreField(Long.class.getName(),
            idFactory.newDatastoreFieldIdentifier(nextValColumnName), nextValMapping, null);
    getStoreManager().getMappingManager().createDatastoreMapping(nextValMapping, storeMgr, colNextVal, Long.class.getName());

        // Set up JDBC statements for supported operations
        insertStmt = "INSERT INTO " + identifier.getFullyQualifiedName(false) + " (" + colSequenceName.getIdentifier() + "," + colNextVal.getIdentifier() +
            ") VALUES (?,?)";
        incrementByStmt = "UPDATE " + identifier.getFullyQualifiedName(false) + " SET " + colNextVal.getIdentifier() + "=(" +
            colNextVal.getIdentifier() + "+?) WHERE " + colSequenceName.getIdentifier() + "=?";
        deleteStmt = "DELETE FROM " + identifier.getFullyQualifiedName(false) + " WHERE " + colSequenceName.getIdentifier() + "=?";
        deleteAllStmt = "DELETE FROM " + identifier.getFullyQualifiedName(false);
        fetchStmt = "SELECT " + colNextVal.getIdentifier() + " FROM " + identifier.getFullyQualifiedName(false) + " WHERE " +
            colSequenceName.getIdentifier() + "=?";
        if (dba.supportsLockWithSelectForUpdate())
        {
            fetchStmt += " FOR UPDATE";
        }
        fetchAllStmt = "SELECT " + colNextVal.getIdentifier() + "," + colSequenceName.getIdentifier() +
            " FROM " + identifier.getFullyQualifiedName(false) + " ORDER BY " + colSequenceName.getIdentifier();

        state = TABLE_STATE_INITIALIZED;
    }
View Full Code Here

Examples of org.jpox.store.mapped.DatastoreField

            AbstractTable refTable = (AbstractTable)storeMgr.getDatastoreClass(idFactory.newDatastoreContainerIdentifier(fki.pkTableName));
            if (refTable != null)
            {
                DatastoreIdentifier colName = idFactory.newIdentifier(IdentifierFactory.COLUMN, fki.fkColumnName);
                DatastoreIdentifier refColName = idFactory.newIdentifier(IdentifierFactory.COLUMN, fki.pkColumnName);
                DatastoreField col = (DatastoreField) columnsByName.get(colName);
                DatastoreField refCol = (DatastoreField) refTable.columnsByName.get(refColName);
                if (col != null && refCol != null)
                {
                    fk.addDatastoreField(col, refCol);
                }
                else
View Full Code Here

Examples of org.jpox.store.mapped.DatastoreField

                                else
                                {
                                    // User-defined name
                                    identifier = idFactory.newDatastoreFieldIdentifier(colmd.getName());
                                }
                                DatastoreField refColumn = addDatastoreField(mapping.getJavaType().getName(), identifier, mapping, colmd);
                                ((Column)refDatastoreMapping.getDatastoreField()).copyConfigurationTo(refColumn);

                                if (colmd == null || (colmd != null && !colmd.isAllowsNullSet()) ||
                                    (colmd != null && colmd.isAllowsNullSet() && colmd.isAllowsNull()))
                                {
                                    // User either wants it nullable, or havent specified anything, so make it nullable
                                    refColumn.setNullable();
                                }

                                fkMapping.addDataStoreMapping(getStoreManager().getMappingManager().createDatastoreMapping(mapping, storeMgr, refColumn, refDatastoreMapping.getJavaTypeMapping().getJavaType().getName()));
                                ((PersistenceCapableMapping)fkMapping).addJavaTypeMapping(mapping);
                            }
View Full Code Here

Examples of org.jpox.store.mapped.DatastoreField

            // No name defined so generate one
            indexColumnName = ((RDBMSIdentifierFactory)idFactory).newForeignKeyFieldIdentifier(fmd, null, null,
                storeMgr.getOMFContext().getTypeManager().isDefaultEmbeddedType(indexType), FieldRole.ROLE_INDEX);
        }

        DatastoreField column = addDatastoreField(indexType.getName(), indexColumnName, indexMapping, colmd);
        if (colmd == null || (colmd != null && !colmd.isAllowsNullSet()) ||
            (colmd != null && colmd.isAllowsNullSet() && colmd.isAllowsNull()))
        {
            // User either wants it nullable, or havent specified anything, so make it nullable
            column.setNullable();
        }

        storeMgr.getMappingManager().createDatastoreMapping(indexMapping, storeMgr, column, indexType.getName());

        return indexMapping;
View Full Code Here

Examples of org.jpox.store.mapped.DatastoreField

                    }

                    boolean found = false;
                    if (acmd.getIdentityType() == IdentityType.DATASTORE)
                    {
                        DatastoreField df = dc.getDataStoreObjectIdMapping().getDataStoreMapping(0).getDatastoreField();
                        if( df.getIdentifier().getIdentifier().equals(columnNames[j]))
                        {
                            //add +1 because result sets in jdbc starts with 1
                            int datastoreIdentityExpressionIndex = j+1;
                            //get object id if datastore identifier
                            if( dc.getDataStoreObjectIdMapping() != null )
                            {
                                id = dc.getDataStoreObjectIdMapping().getObject(om, rs, new int[] {datastoreIdentityExpressionIndex});
                            }
                            found=true;
                        }
                    }
                    for(int k=0; k<acmd.getNoOfManagedMembers()+acmd.getNoOfInheritedManagedMembers() && !found; k++)
                    {
                        AbstractMemberMetaData apmd = acmd.getMetaDataForManagedMemberAtAbsolutePosition(k);
                        if( persistentTypes[i].getColumnForField(apmd.getName())!=null )
                        {
                            if(persistentTypes[i].getColumnForField(apmd.getName()).equals(columnNames[j]))
                            {
                                fieldColumns.put(columnNames[j], apmd);
                                columnsInThisType.add(columnNames[j]);
                                fmds[j] = apmd;
                                found = true;
                            }
                        }
                        else
                        {
                            JavaTypeMapping mapping = dc.getFieldMapping(apmd);
                            for(int l=0; l<mapping.getDataStoreMappings().length && !found; l++)
                            {
                                DatastoreField df = mapping.getDataStoreMapping(l).getDatastoreField();
                                if( df.getIdentifier().getIdentifier().equals(columnNames[j]))
                                {
                                    fieldColumns.put(columnNames[j], apmd);
                                    columnsInThisType.add(columnNames[j]);
                                    fmds[j] = apmd;
                                    found = true;
View Full Code Here

Examples of org.jpox.store.mapped.DatastoreField

    public void initialize(ClassLoaderResolver clr)
    {
        assertIsUninitialized();

    JavaTypeMapping mapping = dba.getMapping(int.class, storeMgr);
    DatastoreField column = addDatastoreField(int.class.getName(),
            storeMgr.getIdentifierFactory().newDatastoreFieldIdentifier("UNUSED"), mapping, null);
    getStoreManager().getMappingManager().createDatastoreMapping(mapping, storeMgr, column, int.class.getName());

        state = TABLE_STATE_INITIALIZED;
    }
View Full Code Here

Examples of org.jpox.store.mapped.DatastoreField

        {
            // No name so generate one
            identifier = ((RDBMSIdentifierFactory)storeMgr.getIdentifierFactory()).newAdapterIndexFieldIdentifier();
        }

        DatastoreField column = table.addDatastoreField(mapping.getType(), identifier, mapping, colmd);
        storeMgr.getMappingManager().createDatastoreMapping(mapping, storeMgr, column, mapping.getJavaType().getName());
        if (pk)
        {
            column.setAsPrimaryKey();
        }

        return column;
    }
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.