Package org.exolab.castor.jdo

Examples of org.exolab.castor.jdo.QueryResults


       
        long begin = System.currentTimeMillis();
       
        OQLQuery query = db.getOQLQuery(
                "SELECT o FROM " + Service.class.getName() + " o order by o.id");
        QueryResults results = query.execute(Database.READONLY);
       
        long result = System.currentTimeMillis();
       
        int count = 0;
        while (results.hasMore()) {
            results.next();
            count++;
        }
       
        long iterate = System.currentTimeMillis();
       
View Full Code Here


        db.begin();
       
        OQLQuery query = db.getOQLQuery("SELECT c FROM "
                + SortedContainer.class.getName() + " c WHERE id = $1");
        query.bind(new Integer(1));
        QueryResults results = query.execute();
       
        SortedContainer entity = null;
       
        entity = (SortedContainer) results.next();
        assertNotNull(entity);
        assertEquals(new Integer(1), entity.getId());
        assertNotNull (entity.getTwos());
        assertEquals(2, entity.getTwos().size());
View Full Code Here

       
        long begin = System.currentTimeMillis();
       
        OQLQuery query = db.getOQLQuery(
                "SELECT o FROM " + Service.class.getName() + " o order by o.id");
        QueryResults results = query.execute(Database.READONLY);
       
        long result = System.currentTimeMillis();
       
        int count = 0;
        while (results.hasMore()) {
            results.next();
            count++;
        }
       
        long iterate = System.currentTimeMillis();
       
View Full Code Here

       
        OQLQuery query = db.getOQLQuery(
                "CALL SQL select PTF_SERVICE.ID as ID "
              + "from PTF_SERVICE order by PTF_SERVICE.ID "
              + "AS " + OID.class.getName());
        QueryResults results = query.execute(Database.READONLY);
       
        long result = System.currentTimeMillis();
       
        int count = 0;
        while (results.hasMore()) {
            OID oid = (OID) results.next();
            db.load(Service.class, oid.getId());
            count++;
        }
       
        long iterate = System.currentTimeMillis();
View Full Code Here

        _db = _category.getDatabase();
    }

    public void runTest() throws PersistenceException, SQLException {
        OQLQuery      oql;
        QueryResults  enumeration;
        Entity        object;

        _db.begin();

        // Determine if test object exists, if not create it.
        // If it exists, set the name to some predefined value
        // that this test will later override.
        oql = _db.getOQLQuery(
                "SELECT object FROM " + Entity.class.getName() + " object WHERE id = $1");
        oql.bind(50);
        enumeration = oql.execute();
        if (enumeration.hasMore()) {
            object = (Entity) enumeration.next();
            LOG.debug("Retrieved object: " + object);
            object.setValue1(Entity.DEFAULT_VALUE_1);
            object.setValue2(Entity.DEFAULT_VALUE_2);
        } else {
            object = new Entity();
            object.setId(50);
            LOG.debug("Creating new object: " + object);
            _db.create(object);
        }
        oql.close();
        _db.commit();

        try {
            LOG.debug("CALL SQL query with object part of an extend hierarchy");
            _db.begin();
            oql = _db.getOQLQuery("CALL SQL "
                    + "SELECT tc3x_entity.id,tc3x_entity.value1,tc3x_entity.value2,"
                    + "tc3x_extends.id,tc3x_extends.value3,tc3x_extends.value4 "
                    + "FROM tc3x_entity LEFT OUTER JOIN tc3x_extends "
                    + "ON tc3x_entity.id=tc3x_extends.id "
                    + "WHERE (tc3x_entity.id = $1) AS " + Entity.class.getName());
            oql.bind(50);
            enumeration = oql.execute();
            if (enumeration.hasMore()) {
                object = (Entity) enumeration.next();
                LOG.debug("Retrieved object: " + object);
            } else {
                fail("test object not found");
            }
            oql.close();
            _db.commit();
        } catch (Exception ex) {
            fail("Exception thrown " + ex);
        }

        LOG.debug("CALL SQL query with simple (stand-alone) object");
        _db.begin();
        CallEntity test = new CallEntity();
        test.setId(55);
        test.setValue1("value1");
        test.setValue2("value2");
        _db.create(test);
        _db.commit();
       
        _db.begin();
        oql = _db.getOQLQuery(
                "CALL SQL SELECT id, value1 , value2 "
                + "FROM tc3x_call WHERE (id = $1) AS " + CallEntity.class.getName());
        oql.bind(55);
        enumeration = oql.execute();
        CallEntity objectEx = null;
        if (enumeration.hasMore()) {
            objectEx = (CallEntity) enumeration.next();
            LOG.debug("Retrieved object: " + objectEx);
        } else {
            fail("test object not found");
        }
        oql.close();
View Full Code Here

       
        OQLQuery query = db.getOQLQuery(
                "CALL SQL select PTF_SERVICE.ID as ID "
              + "from PTF_SERVICE order by PTF_SERVICE.ID "
              + "AS " + OID.class.getName());
        QueryResults results = query.execute(Database.READONLY);
       
        long result = System.currentTimeMillis();
       
        int count = 0;
        while (results.hasMore()) {
            OID oid = (OID) results.next();
            db.load(Service.class, oid.getId());
            count++;
        }
       
        long iterate = System.currentTimeMillis();
View Full Code Here

       
        OQLQuery query = db.getOQLQuery(
                "CALL SQL select PTF_SERVICE.ID as ID "
              + "from PTF_SERVICE order by PTF_SERVICE.ID "
              + "AS " + OID.class.getName());
        QueryResults results = query.execute(Database.READONLY);
       
        long result = System.currentTimeMillis();
       
        int count = 0;
        while (results.hasMore()) {
            OID oid = (OID) results.next();
            db.load(Service.class, oid.getId(), Database.READONLY);
            count++;
        }
       
        long iterate = System.currentTimeMillis();
View Full Code Here

       
        OQLQuery query = db.getOQLQuery(
                "CALL SQL select PTF_SERVICE.ID as ID "
              + "from PTF_SERVICE order by PTF_SERVICE.ID "
              + "AS " + OID.class.getName());
        QueryResults results = query.execute(Database.READONLY);
       
        long result = System.currentTimeMillis();
       
        int count = 0;
        while (results.hasMore()) {
            OID oid = (OID) results.next();
            db.load(Service.class, oid.getId(), Database.READONLY);
            count++;
        }
       
        long iterate = System.currentTimeMillis();
View Full Code Here

       
        OQLQuery query = db.getOQLQuery(
                "CALL SQL select PTF_SERVICE.ID as ID "
              + "from PTF_SERVICE order by PTF_SERVICE.ID "
              + "AS " + OID.class.getName());
        QueryResults results = query.execute(Database.READONLY);
       
        long result = System.currentTimeMillis();
       
        int count = 0;
        while (results.hasMore()) {
            results.next();
            count++;
        }
       
        long iterate = System.currentTimeMillis();
       
View Full Code Here

     */
    private void testDirtyChecked(final AccessMode accessMode)
    throws PersistenceException, SQLException {
        OQLQuery       oql;
        Sample         object;
        QueryResults   enumeration;

        // Open transaction in order to perform JDO operations
        _db.begin();
   
        // Determine if test object exists, if not create it.
        // If it exists, set the name to some predefined value
        // that this test will later override.
        oql = _db.getOQLQuery("SELECT object FROM "
                + Sample.class.getName() + " object WHERE id = $1");
        oql.bind(Sample.DEFAULT_ID);

        enumeration = oql.execute();
        if (enumeration.hasMore()) {
            object = (Sample) enumeration.next();
            LOG.debug("Retrieved object: " + object);
            object.setValue1(Sample.DEFAULT_VALUE_1);
            object.setValue2(Sample.DEFAULT_VALUE_2);
        } else {
            object = new Sample();
View Full Code Here

TOP

Related Classes of org.exolab.castor.jdo.QueryResults

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.