Package org.exolab.castor.jdo

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


     */
    public void testAbsoluteA() throws PersistenceException {
        _db.begin();
        OQLQuery oqlquery = _db.getOQLQuery(
                "SELECT object FROM " + Entity.class.getName() + " object");
        QueryResults enumeration = oqlquery.execute(true);
        assertTrue("should have been able to move to 1", enumeration.absolute(1));
        assertTrue("should have been able to move to 5", enumeration.absolute(5));
        assertTrue("should have been able to move to 10", enumeration.absolute(10));
        assertTrue("should have been able to move to 15", enumeration.absolute(15));
        assertTrue("should have been able to move to 20", enumeration.absolute(20));
View Full Code Here


     */
    public void testAbsoluteB() throws PersistenceException {
        _db.begin();
        OQLQuery oqlquery = _db.getOQLQuery(
                "SELECT object FROM " + Entity.class.getName() + " object");
        QueryResults enumeration = oqlquery.execute(true);
        int next = 1;
        boolean hasMore = true;
        while (enumeration.hasMore() && hasMore) {
            LOG.debug("at: " + next);
            hasMore = enumeration.absolute(next);
View Full Code Here

     */
    public void testAbsoluteC() throws PersistenceException {
        _db.begin();
        OQLQuery oqlquery = _db.getOQLQuery(
                "SELECT object FROM " + Entity.class.getName() + " object");
        QueryResults enumeration = oqlquery.execute(true);
        assertFalse("shouldn't be able to move to -50", enumeration.absolute(-50));
        assertFalse("shouldn't be able to move to 99999", enumeration.absolute(99999));
        _db.commit();
    }

View Full Code Here

    public void testAbsoluteD() {
        try {
            _db.begin();
            OQLQuery oqlquery = _db.getOQLQuery(
                    "SELECT object FROM " + Entity.class.getName() + " object");
            QueryResults enumeration = oqlquery.execute(false);
            // following should fail.
            enumeration.absolute(5);
            _db.commit();
            fail("Calling absolute on a non-scrollable resultset should fail");
        } catch (Exception ex) {
View Full Code Here

            db.begin();
            OQLQuery oqlclean = db.getOQLQuery(
                    "SELECT object FROM " + ManyGroup.class.getName()
                    + " object WHERE object.id < $1");
            oqlclean.bind(Integer.MAX_VALUE);
            enumeration = oqlclean.execute();
            while (enumeration.hasMore()) {
                group = (ManyGroup) enumeration.next();
                _stream.println("Retrieved object: " + group);
                db.remove(group);
                _stream.println("Deleted object: " + group);
View Full Code Here

            db.begin();
            oqlclean = db.getOQLQuery(
                    "SELECT object FROM " + ManyPerson.class.getName()
                    + " object WHERE object.id < $1");
            oqlclean.bind(Integer.MAX_VALUE);
            enumeration = oqlclean.execute();
            while (enumeration.hasMore()) {
                person = (ManyPerson) enumeration.next();
                _stream.println("Retrieved object: " + person);
                db.remove(person);
                _stream.println("Deleted object: " + person);
View Full Code Here

        assertNotNull(db);
        db.begin();
        OQLQuery query = db.getOQLQuery("SELECT h FROM "
                + House.class.getName() + " h WHERE h.flats.id = $1");
        query.bind(2);
        QueryResults result = query.execute();
       
        House e = (House) result.next();
        assertEquals(101, e.getId());
        assertEquals(2, e.getFlats().length);
       
View Full Code Here

        Database db2 = _category.getDatabase();
        db2.begin();

        OQLQuery qry = db2.getOQLQuery(
                "SELECT o FROM " + Lazy1to1Book.class.getName() + " o");
        QueryResults results = qry.execute();
        assertTrue("Couldn't find the book in db: ", results.hasMore());

        Lazy1to1Book book = null;
        if (results.hasMore()) {
            book = (Lazy1to1Book) results.next();
View Full Code Here

        assertNotNull(db);
        db.begin();
        OQLQuery query = db.getOQLQuery("SELECT b FROM " + Book.class.getName()
                + " b WHERE b.title = $1");
        query.bind("Heart of Darkness");
        QueryResults result = query.execute();
       
        int count = 0;
        Book b = null;
        while (result.hasMore()) {
            b = (Book) result.next();
View Full Code Here

       
        // load all EntityOne instances using a named query
        db.begin();
       
        OQLQuery query = db.getNamedQuery(SELECT_ALL_ENTITY_ONE);       
        QueryResults results = query.execute();
        int i = 0;
        while (results.hasMore()) {
            NQEntity entity = (NQEntity) results.next();
            assertNotNull(entity);
            i++;
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.