Package org.jpox.store.query

Examples of org.jpox.store.query.ResultObjectFactory


        {
            stmt = getIteratorStatement(ownerSM, -1, -1);
        }

        // Add the required field selections to the statement
        ResultObjectFactory rof = newResultObjectFactory(ownerSM, stmt, false, true);

        ObjectManager om = ownerSM.getObjectManager();
        Transaction tx = om.getTransaction();
        boolean useUpdateLock = ((Boolean)tx.getOptions().get("transaction.serializeReadObjects")).booleanValue();
        String statement = storeMgr.getStatementTextForQuery(stmt, useUpdateLock);
View Full Code Here


    {
        java.util.List list = new java.util.ArrayList();

        ObjectManager om = sm.getObjectManager();
        QueryExpression stmt = getIteratorStatement(sm, start, end);
        ResultObjectFactory getROF = newResultObjectFactory(sm,stmt,false,true);
        Transaction tx = om.getTransaction();
        boolean useUpdateLock = ((Boolean)tx.getOptions().get("transaction.serializeReadObjects")).booleanValue();
        String statement = storeMgr.getStatementTextForQuery(stmt, useUpdateLock);

        try
        {
            ManagedConnection mconn = storeMgr.getConnection(om);
            SQLController sqlControl = storeMgr.getSQLController();
            try
            {
                PreparedStatement ps = storeMgr.getStatementForQuery(stmt, om, mconn, useUpdateLock, null, null);
                try
                {
                    ResultSet rs = sqlControl.executeStatementQuery(mconn, statement, ps);
                    try
                    {
                        while (rs.next())
                        {
                            Object obj = null;

                            if (elementsAreEmbedded || elementsAreSerialised)
                            {
                                int param[] = new int[elementMapping.getNumberOfDatastoreFields()];
                                for (int i = 0; i < param.length; ++i)
                                {
                                    param[i] = i + 1;
                                }
                                obj = elementMapping.getObject(om, rs, param);
                            }
                            else if (elementMapping instanceof ReferenceMapping)
                            {
                                // Element = Reference (Interface/Object)
                                int param[] = new int[elementMapping.getNumberOfDatastoreFields()];
                                for (int i = 0; i < param.length; ++i)
                                {
                                    param[i] = i + 1;
                                }
                                obj = elementMapping.getObject(om, rs, param);
                            }
                            else
                            {
                                obj = getROF.getObject(om, rs);
                            }

                            list.add(obj);
                        }
View Full Code Here

        // Create the basic statement (without any selected columns)
        QueryExpression stmt = getGetStatement(sm,key);

        // Add the required field selections to the statement
        ResultObjectFactory rof = newResultObjectFactory(sm, stmt, false, true);

        ObjectManager om = sm.getObjectManager();
        Transaction tx = om.getTransaction();
        boolean useUpdateLock = ((Boolean)tx.getOptions().get("transaction.serializeReadObjects")).booleanValue();
        String statement = storeMgr.getStatementTextForQuery(stmt, useUpdateLock);

        Object value=null;
        try
        {
            ManagedConnection mconn = storeMgr.getConnection(om);
            SQLController sqlControl = storeMgr.getSQLController();
            try
            {
                PreparedStatement ps = storeMgr.getStatementForQuery(stmt, om, mconn, useUpdateLock, null, null);
                try
                {
                    ResultSet rs = sqlControl.executeStatementQuery(mconn, statement, ps);
                    try
                    {
                        boolean found = rs.next();
                        if (!found)
                        {
                            throw new NoSuchElementException();
                        }

                        if (valuesAreEmbedded || valuesAreSerialised)
                        {
                            int param[] = new int[valueMapping.getNumberOfDatastoreFields()];
                            for (int i = 0; i < param.length; ++i)
                            {
                                param[i] = i + 1;
                            }

                            if (valueMapping instanceof SerialisedPCMapping ||
                                valueMapping instanceof SerialisedReferenceMapping ||
                                valueMapping instanceof EmbeddedKeyPCMapping)
                            {
                                // Value = Serialised
                                int ownerFieldNumber = -1;
                                if (mapTable != null)
                                {
                                    ownerFieldNumber = ((JoinTable)mapTable).getOwnerFieldMetaData().getAbsoluteFieldNumber();
                                }
                                value = valueMapping.getObject(om, rs, param, sm, ownerFieldNumber);
                            }
                            else
                            {
                                // Value = Non-PC
                                value = valueMapping.getObject(om, rs, param);
                            }
                        }
                        else if (valueMapping instanceof ReferenceMapping)
                        {
                            // Value = Reference (Interface/Object)
                            int param[] = new int[valueMapping.getNumberOfDatastoreFields()];
                            for (int i = 0; i < param.length; ++i)
                            {
                                param[i] = i + 1;
                            }
                            value = valueMapping.getObject(om, rs, param);
                        }
                        else
                        {
                            // Value = PC
                            value = rof.getObject(om, rs);
                        }

                        SQLWarnings.log(rs);
                    }
                    finally
View Full Code Here

                        // Execute the query
                        ResultSet rs = sqlControl.executeStatementQuery(mconn, compiledSQL, ps);
                        try
                        {
                            ResultObjectFactory rof = null;
                            if (candidateClass != null)
                            {
                                ResultSetMetaData rsmd = rs.getMetaData();
                                HashSet remainingColumnNames = new HashSet(fieldColumnNames);
View Full Code Here

        {
            throw new JPOXException(LOCALISER.msg("056005")).setFatal();
        }

        // Add the required field selections to the statement and get a factory for extracting them
        ResultObjectFactory rof = newResultObjectFactory(ownerSM, stmt, false, true);

        ObjectManager om = ownerSM.getObjectManager();
        Transaction tx = om.getTransaction();
        boolean useUpdateLock = ((Boolean)tx.getOptions().get("transaction.serializeReadObjects")).booleanValue();
        String statement = storeMgr.getStatementTextForQuery(stmt, useUpdateLock);
View Full Code Here

        {
            throw new JPOXException(LOCALISER.msg("056005")).setFatal();
        }

        // Add the required field selections to the statement and get a factory for extracting them
        ResultObjectFactory rof = newResultObjectFactory(ownerSM, stmt, false, true);

        ObjectManager om = ownerSM.getObjectManager();
        Transaction tx = om.getTransaction();
        boolean useUpdateLock = ((Boolean)tx.getOptions().get("transaction.serializeReadObjects")).booleanValue();
        String statement = storeMgr.getStatementTextForQuery(stmt, useUpdateLock);
View Full Code Here

TOP

Related Classes of org.jpox.store.query.ResultObjectFactory

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.