Package org.odmg

Examples of org.odmg.OQLQuery.execute()


            OQLQuery query = odmg.newOQLQuery();
            query.create("select anArticle from " + Article.class.getName() + " where articleId = $678");
            query.bind(new Integer(30));

            List results = (List) query.execute();

            Article a = (Article) results.get(0);

            //crosscheck with PersistenceBroker lookup
            // 1. get OID
View Full Code Here


        {
            tx.begin();
            OQLQuery query = odmg.newOQLQuery();
            query.create("select aLotOfArticles from " + Article.class.getName() + " where productGroupId = 4");

            DCollection results = (DCollection) query.execute();
            results = results.query("price > 35");

            // now perform control query
            query = odmg.newOQLQuery();
            query.create(
View Full Code Here

            query.create(
                    "select aLotOfArticles from "
                    + Article.class.getName()
                    + " where productGroupId = 4 and price  > 35");

            DCollection check = (DCollection) query.execute();

            assertEquals(results, check);

            tx.commit();
        }
View Full Code Here

            // retrieve an Article
            OQLQuery query = odmg.newOQLQuery();
            query.create("select anArticle from " + Article.class.getName() + " where articleId = $678");
            query.bind(new Integer(30));
            List results = (List) query.execute();
            Article a = (Article) results.get(0);

            // manipulate metadata
            broker = ((TransactionImpl) tx).getBroker();
            cld = broker.getClassDescriptor(Article.class);
View Full Code Here

        // make sure all objects are retrieved freshly in subsequent transactions
        ((TransactionImpl) tx).getBroker().clearCache();
        OQLQuery qry = odmg.newOQLQuery();
        qry.create("select a from " + PersonImpl.class.getName() + " where firstname=$1");
        qry.bind(firstnameFather);
        Collection result = (Collection) qry.execute();

        assertEquals("Exactly one element in result set", 1, result.size());
        Person returnedFather = (Person) result.iterator().next();
        // should retrieve new instance
        assertTrue("not same", returnedFather != father);
View Full Code Here

        tx.commit();

        qry = odmg.newOQLQuery();
        qry.create("select a from " + PersonImpl.class.getName() + " where firstname=$1");
        qry.bind(firstnameFather);
        result = (Collection) qry.execute();
        assertEquals("Exactly one element in result set", 0, result.size());

        qry = odmg.newOQLQuery();
        qry.create("select a from " + PersonImpl.class.getName() + " where firstname=$1");
        qry.bind(firstnameChild_1);
View Full Code Here

        assertEquals("Exactly one element in result set", 0, result.size());

        qry = odmg.newOQLQuery();
        qry.create("select a from " + PersonImpl.class.getName() + " where firstname=$1");
        qry.bind(firstnameChild_1);
        result = (Collection) qry.execute();
        // System.out.println("child: "+result.iterator().next());
        assertEquals("Exactly one element in result set", 0, result.size());
    }

    /*
 
View Full Code Here

        // make sure all objects are retrieved freshly in subsequent transactions
        ((TransactionImpl) tx).getBroker().clearCache();
        OQLQuery qry = odmg.newOQLQuery();
        qry.create("select a from " + PersonImpl.class.getName() + " where firstname=$1");
        qry.bind(firstnameFather);
        Collection result = (Collection) qry.execute();

        assertEquals("Exactly one element in result set", 1, result.size());
        Person returnedFather = (Person) result.iterator().next();
        // should retrieve new instance
        assertTrue("not same", returnedFather != father);
View Full Code Here

        tx.commit();

        qry = odmg.newOQLQuery();
        qry.create("select a from " + PersonImpl.class.getName() + " where firstname=$1");
        qry.bind(firstnameFather);
        result = (Collection) qry.execute();
        assertEquals("Exactly one element in result set", 0, result.size());

        qry = odmg.newOQLQuery();
        qry.create("select a from " + PersonImpl.class.getName() + " where firstname=$1");
        qry.bind(firstnameChild_1);
View Full Code Here

        assertEquals("Exactly one element in result set", 0, result.size());

        qry = odmg.newOQLQuery();
        qry.create("select a from " + PersonImpl.class.getName() + " where firstname=$1");
        qry.bind(firstnameChild_1);
        result = (Collection) qry.execute();
        // System.out.println("child: "+result.iterator().next());
        assertEquals("Exactly one element in result set", 0, result.size());
    }

    /**
 
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.