Package org.exolab.castor.jdo

Examples of org.exolab.castor.jdo.OQLQuery.execute()


        database.begin();
       
        Product pq;
        OQLQuery query = database.getOQLQuery("select p from "
                + ctf.jdo.tc8x.Product.class.getName() + " p order by p.id");
        QueryResults results = query.execute();
       
        pq = (Product) results.next();
        assertEquals(pq, new Product(1, "LCD", KindEnum.MONITOR));
        database.remove(pq);
View Full Code Here


        db.begin();
        String s = "SELECT e FROM " + Employee.class.getName() + " e "
                 + "WHERE e.holiday > $1";
        OQLQuery qry = db.getOQLQuery(s);
        qry.bind(50.0);
        QueryResults rst = qry.execute();
        while (rst.hasMore()) {
            Employee emp = (Employee) rst.next();
            emp.setHoliday(50.0f);
        }
        rst.close();
View Full Code Here

        db.begin();
       
        OQLQuery query = db.getOQLQuery("SELECT entity FROM "
                + SelfReferentialParent.class.getName() + " entity WHERE id = $1");
        query.bind(new Integer(1));
        QueryResults results = query.execute();
       
        SelfReferentialParent entity = (SelfReferentialParent) results.next();

        assertNotNull(entity);
        assertEquals(new Integer(1), entity.getId());
View Full Code Here

     */
    public final void testSizeA() throws PersistenceException {
        _db.begin();
        OQLQuery oqlquery = _db.getOQLQuery(
                "SELECT object FROM " + Entity.class.getName() + " object");
        QueryResults enumeration = oqlquery.execute(true);
        assertTrue("size should be > 0", enumeration.size() > 0);
        _db.commit();
    }

    /**
 
View Full Code Here

     */
    public final void testSizeB() throws PersistenceException {
        _db.begin();
        OQLQuery oqlquery = _db.getOQLQuery(
                "SELECT object FROM " + Entity.class.getName() + " object");
        QueryResults enumeration = oqlquery.execute(true);
        while (enumeration.hasMore()) {
            enumeration.next();
            assertTrue("size should be > 0", enumeration.size() > 0);
            assertEquals("size should be ==25", enumeration.size(), 25);
        }
View Full Code Here

     */
    public final void testSizeC() throws PersistenceException {
        _db.begin();
        OQLQuery oqlquery = _db.getOQLQuery(
                "SELECT object FROM " + Entity.class.getName() + " object");
        QueryResults enumeration = oqlquery.execute(true);
        int expectedSize = enumeration.size();
        int realSize = 0;
        while (enumeration.hasMore()) {
            enumeration.next();
            realSize++;
View Full Code Here

        // Remove and create the object
        _db = _category.getDatabase();
        _db.begin();
        oql = _db.getOQLQuery("select obj from "
                + TimeStampableObject.class.getName() + " obj");
        enumeration = oql.execute();
        if (enumeration.hasMore()) {
            object = (TimeStampableObject) enumeration.next();
            LOG.debug("Removing object: " + object);
            _db.remove(object);
        }
View Full Code Here

    public void testSizeD() {
        try {
            _db.begin();
            OQLQuery oqlquery = _db.getOQLQuery(
                    "SELECT object FROM " + Entity.class.getName() + " object");
            oqlquery.execute(false);
            _db.commit();
            // This test fails when executed against PostgreSQL.
            fail ("Calling size() on a non-scrollable ResultSet should fail.");
        } catch (Exception ex) {
            assertTrue(true);
View Full Code Here

        // Load the object
        _db = _category.getDatabase();
        _db.begin();
        oql = _db.getOQLQuery("select obj from "
                + TimeStampableObject.class.getName() + " obj");
        enumeration = oql.execute();

        if (enumeration.hasMore()) {
            object = (TimeStampableObject) enumeration.next();
            LOG.debug("Loaded object: " + object);
        }
View Full Code Here

        //object = (TestUuidObject) _db.load( objClass, object.getId() );
        oql = _db.getOQLQuery();
        oql.create("SELECT object FROM " + objClass.getName()
                + " object WHERE id = $1");
        oql.bind(object.getId());
        enumeration = oql.execute();
        LOG.debug("Removing first object: " + object);
        if (enumeration.hasMore()) {
            object = (UuidObject) enumeration.next();
            _db.remove(object);
            LOG.debug("OK: Removed");
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.