Package org.exolab.castor.jdo

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


        OQLQuery query = getDatabase().getOQLQuery("select t from "
                + Entity.class.getName() + " t order by id limit $1 offset $2");

        query.bind(LIMIT);
        query.bind(OFFSET);

        QueryResults results = query.execute();
        assertNotNull (results);
        /*size() not available using an Oracle DB
        assertEquals (LIMIT, results.size()); */
 
View Full Code Here


    private void deletePersons() throws PersistenceException {
        _db.begin();
        OQLQuery oqlclean = _db.getOQLQuery("SELECT object FROM "
                + ManyPerson.class.getName() + " object WHERE object.id < $1");
        oqlclean.bind(Integer.MAX_VALUE);
        QueryResults enumeration = oqlclean.execute();
        while (enumeration.hasMore()) {
            _person1 = (ManyPerson) enumeration.next();
            _stream.println("Retrieved object: " + _person1);
            _db.remove(_person1);
View Full Code Here

        // 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.
        OQLQuery oql = _db.getOQLQuery("SELECT object FROM "
                + Sample.class.getName() + " object WHERE id = $1");
        oql.bind(Sample.DEFAULT_ID);
       
        QueryResults enumeration = oql.execute();
        Sample    object;
        if (enumeration.hasMore()) {
            object = (Sample) enumeration.next();
View Full Code Here

    public void test(final Database db) throws Exception {
        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);
        }
View Full Code Here

        Database db = _category.getDatabase();
        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);
View Full Code Here

        // Find the first object and remove it
        //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);
View Full Code Here

        // Find the second object and remove it
        //ext = (TestUuidObject) _db.load( extClass, ext.getId() );
        oql = _db.getOQLQuery();
        oql.create("SELECT ext FROM " + extClass.getName()
                + " ext WHERE id = $1");
        oql.bind(ext.getId());
        enumeration = oql.execute();
        LOG.debug("Removing second object: " + ext);
        if (enumeration.hasMore()) {
            ext = (UuidObject) enumeration.next();
            _db.remove(ext);
View Full Code Here

            db = this._category.getDatabase();
            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);
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);
View Full Code Here

        db = _jdo.getDatabase();
        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

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.