Examples of newQuery()


Examples of org.apache.openjpa.kernel.Broker.newQuery()

        // test against database
//        OpenJPAQuery q = pm.createQuery("SELECT o FROM "+c.getSimpleName()+"o WHERE o."+filter);
        String qstrng =
            "SELECT o FROM " + c.getSimpleName() + " o WHERE o." + filter;
        assertSize(size,
            (List) broker.newQuery(JPQLParser.LANG_JPQL, c, qstrng).execute());

        broker.commit();
        broker.close();

        broker = getBrokerFactory().newBroker();
View Full Code Here

Examples of org.apache.openjpa.kernel.Broker.newQuery()

        broker = getBrokerFactory().newBroker();
        broker.begin();
        // test again against a new PM, for good measure
        assertSize(size,
            (List) broker.newQuery(JPQLParser.LANG_JPQL, c, qstrng).execute());
        broker.rollback();

        broker.close();
    }
View Full Code Here

Examples of org.apache.openjpa.kernel.Broker.newQuery()

        super(name);
    }

    public void testSimpleSubqueryAccessPath() {
        Broker broker = getBrokerFactory().newBroker();
        Query q = broker.newQuery(JPQLParser.LANG_JPQL,
            "SELECT o FROM RuntimeTest1 o WHERE EXISTS (SELECT rt5.name FROM RuntimeTest5 rt5 WHERE rt5.name IS NOT NULL)");
        ClassMetaData[] metas = q.getAccessPathMetaDatas();
        Collection c = Arrays.asList(metas);
        ClassMetaData rt1 = broker.getConfiguration().
            getMetaDataRepositoryInstance().getMetaData(RuntimeTest1.class,
View Full Code Here

Examples of org.apache.openjpa.kernel.Broker.newQuery()

        assertEquals(2, c.size());
    }

    public void testRelationTraversalSubqueryAccessPath() {
        Broker broker = getBrokerFactory().newBroker();
        Query q = broker.newQuery(JPQLParser.LANG_JPQL,
            "SELECT o FROM RuntimeTest1 o WHERE EXISTS (SELECT rt5.runtimeTest4.name FROM RuntimeTest5 rt5 WHERE rt5.name IS NOT NULL)");

        ClassMetaData[] metas = q.getAccessPathMetaDatas();
        Collection c = Arrays.asList(metas);
        ClassMetaData rt1 = broker.getConfiguration().
View Full Code Here

Examples of org.apache.openjpa.kernel.Broker.newQuery()

            long q1p2;
            long q2p1;
            long q2p2;

            Broker broker = JPAFacadeHelper.toBroker(em);
            org.apache.openjpa.kernel.Query q = broker.newQuery(
                JPQLParser.LANG_JPQL, "Select a FROM "
                + CacheObjectA.class.getSimpleName() + " a");
            q.setCandidateExtent(broker.newExtent(CacheObjectA.class, false));
            start = System.currentTimeMillis();
            assertInCache(q, inCache);
View Full Code Here

Examples of org.apache.openjpa.kernel.Broker.newQuery()

            List l2 = (List) q.execute();
            iterate(l2);
            q1p2 = System.currentTimeMillis() - start;
            assertEquals(allSize, l2.size());

            q = broker.newQuery(JPQLParser.LANG_JPQL,
                "select a.name,a.age from "
                    + CacheObjectA.class.getSimpleName()
                    + " a where a.name = :n AND a.age = :a");
            q.setCandidateExtent(broker.newExtent(CacheObjectA.class, false));
            start = System.currentTimeMillis();
View Full Code Here

Examples of org.apache.openjpa.kernel.Broker.newQuery()

    }

    public void testNonCacheableClass() {
        Broker broker = JPAFacadeHelper.toBrokerFactory(factory).newBroker();
        try {
            org.apache.openjpa.kernel.Query q = broker.newQuery(
                JPQLParser.LANG_JPQL, "Select a FROM "
                + CacheObjectB.class.getSimpleName() + " a");

            Collection c = (Collection) q.execute();
            iterate(c);
View Full Code Here

Examples of org.apache.openjpa.kernel.Broker.newQuery()

    }

    public void testNonCacheableAccessPath() {
        Broker broker = JPAFacadeHelper.toBrokerFactory(factory).newBroker();
        try {
            org.apache.openjpa.kernel.Query q = broker.newQuery(
                JPQLParser.LANG_JPQL, "Select a FROM "
                + CacheObjectA.class.getSimpleName()
                + " a where a.relatedB.str = 'foo'");
            // "relatedB.str == 'foo'");
            q.setCandidateExtent(broker.newExtent(CacheObjectA.class, false));
View Full Code Here

Examples of org.apache.openjpa.kernel.Broker.newQuery()

    public void testNonCacheableSubclasses1() {
        Broker broker = JPAFacadeHelper.toBrokerFactory(factory).newBroker();
        try {
            // a query on the CacheObjectA class includes an uncacheable
            // class; it should therefore not be cacheable.
            org.apache.openjpa.kernel.Query q = broker.newQuery(
                JPQLParser.LANG_JPQL, "Select a FROM "
                + CacheObjectA.class.getSimpleName() + " a");

            Collection c = (Collection) q.execute();
            iterate(c);
View Full Code Here

Examples of org.apache.openjpa.kernel.Broker.newQuery()

        Broker broker = JPAFacadeHelper.toBrokerFactory(factory).newBroker();
        try {
            // a query on the CacheObjectA extent configured without
            // subclasses does not include an uncacheable class; it should
            // therefore be cacheable.
            org.apache.openjpa.kernel.Query q = broker.newQuery(
                JPQLParser.LANG_JPQL, "select a from "
                + CacheObjectA.class.getSimpleName() + " a");
            q.setCandidateExtent(broker.newExtent(CacheObjectA.class, false));

            Collection c = (Collection) q.execute();
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.