Package org.jpox.store.mapped

Examples of org.jpox.store.mapped.DatastoreAdapter


            candidateCmd = null;
        }
        else
        {
            MappedStoreManager storeMgr = (MappedStoreManager)om.getStoreManager();
            DatastoreAdapter dba = storeMgr.getDatastoreAdapter();
            candidateCmd = om.getMetaDataManager().getMetaDataForClass(candidateClass,om.getClassLoaderResolver());
            if (candidateCmd == null)
            {
                throw new ClassNotPersistenceCapableException(candidateClass.getName());
            }
            if (candidateCmd.getPersistenceCapableSuperclass() != null)
            {
                throw new PersistentSuperclassNotAllowedException(candidateClass.getName());
            }
            if (candidateCmd.isRequiresExtent())
            {
                throw new JPOXUserException(LOCALISER_RDBMS.msg("060000",
                    candidateClass.getName()));
            }
            if (candidateCmd.getIdentityType() != IdentityType.NONDURABLE)
            {
                throw new JPOXUserException(LOCALISER_RDBMS.msg("060001",
                    candidateClass.getName()));
            }

            int fieldCount = candidateCmd.getNoOfManagedMembers();
            int[] fn = new int[fieldCount];
            statementExpressionIndex = new StatementExpressionIndex[fieldCount];
            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)
                {
                    JavaTypeMapping m = dba.getMapping(fieldType, storeMgr, om.getClassLoaderResolver());
                    if (m.includeInFetchStatement())
                    {
                        statementExpressionIndex[fieldNumber].setMapping(m);
                        fn[n++] = fieldNumber;
View Full Code Here


        {
            QueryResult qr = null;
            try
            {
                RDBMSManager storeMgr = (RDBMSManager)om.getStoreManager();
                DatastoreAdapter dba = storeMgr.getDatastoreAdapter();
                ManagedConnection mconn = storeMgr.getConnection(om);
                Connection conn = (Connection) mconn.getConnection();
                SQLController sqlControl = storeMgr.getSQLController();

                try
                {
                    PreparedStatement ps = conn.prepareStatement(compiledSQL);
                    try
                    {
                        Iterator iter = parameterOccurrences.iterator();
                        int stmtParamNum = 1;

                        while (iter.hasNext())
                        {
                            String paramName = (String) iter.next();
                            Class paramType = (Class) parameterTypesByName.get(paramName);

                            if (!parameters.containsKey(paramName))
                            {
                                throw new JPOXUserException(LOCALISER_RDBMS.msg("060006",
                                    paramName));
                            }
                            if (paramType == null)
                            {
                                throw new JPOXUserException(LOCALISER_RDBMS.msg("060007",
                                    paramName));
                            }

                            JavaTypeMapping mapping = dba.getMapping(paramType, storeMgr,
                                om.getClassLoaderResolver());
                            Object paramValue = parameters.get(paramName);

                            mapping.setObject(om, ps, Mappings.getParametersIndex(stmtParamNum,mapping), paramValue);
                            if (mapping.getNumberOfDatastoreFields() == 0)
View Full Code Here

                {
                    versionMissing = false;
                }

                // Go through the selected fields and check the existence of id, version, discriminator cols
                DatastoreAdapter dba = storeMgr.getDatastoreAdapter();
                final AbstractClassMetaData candidateCmd = om.getMetaDataManager().getMetaDataForClass(candidateClass, clr);
                for (int i = 0; i < selectedColumns.length; i++)
                {
                    String colName = selectedColumns[i].trim();
                    if (colName.indexOf(" AS ") > 0)
View Full Code Here

        private ResultObjectFactory getResultObjectFactoryForCandidateClass(ResultSet rs)
        throws SQLException
        {
            ClassLoaderResolver clr = om.getClassLoaderResolver();
            MappedStoreManager storeMgr = (MappedStoreManager)om.getStoreManager();
            DatastoreAdapter dba = storeMgr.getDatastoreAdapter();

            // Create an index listing for ALL (fetchable) fields in the result class.
            final AbstractClassMetaData candidateCmd = om.getMetaDataManager().getMetaDataForClass(candidateClass, clr);
            int fieldCount = candidateCmd.getNoOfManagedMembers() + candidateCmd.getNoOfInheritedManagedMembers();
            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)
                {
                    JavaTypeMapping m = null;
                    if (tbl != null)
                    {
                        // Get the field mapping from the candidate table
                        m = tbl.getFieldMapping(fmd);
                    }
                    else
                    {
                        // Fall back to generating a mapping for this type - does this ever happen?
                        m = dba.getMapping(fieldType, storeMgr, clr);
                    }
                    if (m.includeInFetchStatement())
                    {
                        // Set mapping for this field since it can potentially be returned from a fetch
                        statementExpressionIndex[fieldNumber].setMapping(m);
View Full Code Here

TOP

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

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.