Package org.jpox.store.mapped

Examples of org.jpox.store.mapped.StatementExpressionIndex


                int j=0;
                while (it.hasNext())
                {
                    AbstractMemberMetaData apmd = (AbstractMemberMetaData)it.next();
                    fieldNumbers[j] = apmd.getAbsoluteFieldNumber();
                    statementExpressionIndex[fieldNumbers[j]] = new StatementExpressionIndex();
                    List indexes = new ArrayList();
                    for( int k=0; k<fmds.length; k++)
                    {
                        if( fmds != null && fmds[k] == apmd)
                        {
View Full Code Here


            fieldColumnNames = new ArrayList(fieldCount);
            int n = 0;

            for (int fieldNumber = 0; fieldNumber < fieldCount; ++fieldNumber)
            {
                statementExpressionIndex[fieldNumber] = new StatementExpressionIndex();
                AbstractMemberMetaData fmd = candidateCmd.getMetaDataForManagedMemberAtPosition(fieldNumber);
                String fieldName = fmd.getName();
                Class fieldType = fmd.getType();

                if (fmd.getPersistenceModifier() == FieldPersistenceModifier.PERSISTENT)
View Full Code Here

                    }
                }

                Integer abs_field_num = new Integer(fmd.getAbsoluteFieldNumber());
                int parametersIndex[] = new int[m.getNumberOfDatastoreFields()];
                StatementExpressionIndex sei = new StatementExpressionIndex();
                sei.setMapping(m);
                sei.setParameterIndex(parametersIndex);

                if (fmd.isPrimaryKey())
                {
                    //primary keys goes to the WHERE COLUMN = ?, ....
                    mappingStatementIndex.getPrimaryKeys()[fmd.getAbsoluteFieldNumber()] = sei;
View Full Code Here

            {
                // Surrogate version column
                String inputParam = ((RDBMSMapping)m.getDataStoreMapping(0)).getUpdateInputParameter();

                int[] param = { paramIndex++ };
                StatementExpressionIndex versStmtIdx = null;
                if (whereClauseConsumption)
                {
                    versStmtIdx = mappingStatementIndex.getVersion2();
                    String condition = " AND " + m.getDataStoreMapping(0).getDatastoreField().getIdentifier() + "=" + inputParam;
                    where.append(condition);
                }
                else
                {
                    versStmtIdx = mappingStatementIndex.getVersion();
                    String condition = m.getDataStoreMapping(0).getDatastoreField().getIdentifier() + "=" + inputParam;
                    if (columnAssignments.length() > 0)
                    {
                        columnAssignments.append(", ");
                    }
                    columnAssignments.append(condition);
                }
                versStmtIdx.setMapping(m);
                versStmtIdx.setParameterIndex(param);
            }
            else if (mappingType == MappingConsumer.MAPPING_TYPE_DATASTORE_ID)
            {
                // Surrogate datastore id column
                String condition = ((DatastoreField)key.getColumns().get(0)).getIdentifier() + "=?";
View Full Code Here

            }
            else if (mappingType == MappingConsumer.MAPPING_TYPE_VERSION)
            {
                if (whereClauseConsumption)
                {
                    StatementExpressionIndex versStmtIdx = mappingStatementIndex.getVersion2();
                    int[] param = { paramIndex++ };
                    versStmtIdx.setMapping(m);
                    versStmtIdx.setParameterIndex(param);
                    String inputParam = ((RDBMSMapping)m.getDataStoreMapping(0)).getUpdateInputParameter();
                    String condition = " AND " + m.getDataStoreMapping(0).getDatastoreField().getIdentifier() + "=" + inputParam;
                    where.append(condition);
                }
            }
View Full Code Here

            {
                return;
            }
            if (m.includeInFetchStatement())
            {
                mappingStatementIndex.getFields()[fmd.getAbsoluteFieldNumber()] = new StatementExpressionIndex();
                mappingStatementIndex.getFields()[fmd.getAbsoluteFieldNumber()].setMapping(m);

                // create the expressions index (columns index)
                int expressionsIndex[] = null;
                if (m.getNumberOfDatastoreFields() == 0 &&
View Full Code Here

            }           
            if (m.includeInUpdateStatement())
            {
                int parametersIndex[] = new int[m.getNumberOfDatastoreFields()];

                StatementExpressionIndex sei = new StatementExpressionIndex();
                sei.setMapping(m);
                sei.setParameterIndex(parametersIndex);

                if (fmd.isPrimaryKey())
                {
                    // Application id - for WHERE
                    versionMappingStatementIndex.getPrimaryKeys()[fmd.getAbsoluteFieldNumber()] = sei;
View Full Code Here

        public void consumeMapping(JavaTypeMapping m, AbstractMemberMetaData fmd)
        {
            if (m.includeInFetchStatement())
            {
                mappingStatementIndex.getFields()[fmd.getAbsoluteFieldNumber()] = new StatementExpressionIndex();
                mappingStatementIndex.getFields()[fmd.getAbsoluteFieldNumber()].setMapping(m);

                /*
                 * check if the our column is primary key. if the
                 * first column for the mapping is primary key,
View Full Code Here

            Map columnFieldNumberMap = new HashMap(); // Map of field numbers keyed by the column name
            statementExpressionIndex = new StatementExpressionIndex[fieldCount];
            DatastoreClass tbl = storeMgr.getDatastoreClass(candidateClass.getName(), clr);
            for (int fieldNumber = 0; fieldNumber < fieldCount; ++fieldNumber)
            {
                statementExpressionIndex[fieldNumber] = new StatementExpressionIndex();
                AbstractMemberMetaData fmd = candidateCmd.getMetaDataForManagedMemberAtAbsolutePosition(fieldNumber);
                String fieldName = fmd.getName();
                Class fieldType = fmd.getType();

                if (fmd.getPersistenceModifier() != FieldPersistenceModifier.NONE)
View Full Code Here

            {
                if (fmd.isPrimaryKey())
                {
                    Integer abs_field_num = new Integer(fmd.getAbsoluteFieldNumber());
                    int parametersIndex[] = new int[m.getNumberOfDatastoreFields()];
                    StatementExpressionIndex sei = new StatementExpressionIndex();
                    sei.setMapping(m);
                    sei.setParameterIndex(parametersIndex);

                    mappingStatementIndex.getPrimaryKeys()[fmd.getAbsoluteFieldNumber()] = sei;
                    for (int j=0; j<parametersIndex.length; j++)
                    {
                        if (where.length() > 0)
                        {
                            where.append(" AND ");
                        }
                        String condition = m.getDataStoreMapping(j).getDatastoreField().getIdentifier() +
                            "=" + ((RDBMSMapping)m.getDataStoreMapping(j)).getUpdateInputParameter();
                        where.append(condition);

                        if (!pkFields.contains(abs_field_num))
                        {
                            pkFields.add(abs_field_num);
                        }
                        parametersIndex[j] = paramIndex++;
                    }
                }
                else if (m instanceof PersistenceCapableMapping || m instanceof ReferenceMapping)
                {
                    if (m.getNumberOfDatastoreFields() == 0)
                    {
                        // Field storing a PC object with FK at other side
                        int relationType = fmd.getRelationType(clr);
                        if (relationType == Relation.ONE_TO_ONE_BI)
                        {
                            if (fmd.getMappedBy() != null)
                            {
                                // 1-1 bidirectional field without datastore column(s) (with single FK at other side)
                                oneToOneNonOwnerFields.add(fmd);
                            }
                        }
                        else if (relationType == Relation.MANY_TO_ONE_BI)
                        {
                            AbstractMemberMetaData[] relatedMmds = fmd.getRelatedMemberMetaData(clr);
                            if (fmd.getJoinMetaData() != null || relatedMmds[0].getJoinMetaData() != null)
                            {
                                // 1-N bidirectional using join table for relation
                                // TODO Anything to do here ?
                            }
                        }
                    }
                }
                else
                {
                    if (whereClauseConsumption)
                    {
                        // Must be version field since nothing else should come through here
                        int parametersIndex[] = new int[m.getNumberOfDatastoreFields()];
                        parametersIndex[0] = paramIndex++;
                        StatementExpressionIndex sei = new StatementExpressionIndex();
                        sei.setMapping(m);
                        sei.setParameterIndex(parametersIndex);
                        mappingStatementIndex.setVersion2(sei);
                        String inputParam = ((RDBMSMapping)m.getDataStoreMapping(0)).getUpdateInputParameter();
                        String condition = " AND " + m.getDataStoreMapping(0).getDatastoreField().getIdentifier() + "=" + inputParam;
                        where.append(condition);
                    }
View Full Code Here

TOP

Related Classes of org.jpox.store.mapped.StatementExpressionIndex

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.