Package org.apache.openjpa.kernel

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


    }

    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

    }

    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

    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

        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

            // build up some queries to test

            // this one should be only on the superclass, since
            // CacheObjectF has a timeout.
            Broker broker = JPAFacadeHelper.toBroker(em);
            org.apache.openjpa.kernel.Query q1 = broker.newQuery(
                JPQLParser.LANG_JPQL, "select a from "
                + CacheObjectE.class.getSimpleName() + " a");
            q1.setCandidateExtent(broker.newExtent(CacheObjectE.class, false));
            iterate((Collection) q1.execute());
            assertInCache(q1, Boolean.TRUE);
View Full Code Here

                + CacheObjectE.class.getSimpleName() + " a");
            q1.setCandidateExtent(broker.newExtent(CacheObjectE.class, false));
            iterate((Collection) q1.execute());
            assertInCache(q1, Boolean.TRUE);

            org.apache.openjpa.kernel.Query q2 = broker.newQuery(
                JPQLParser.LANG_JPQL, "Select a FROM "
                + CacheObjectF.class.getSimpleName() + " a");
            iterate((Collection) q2.execute());
            assertInCache(q2, Boolean.TRUE);
View Full Code Here

            endTx(em);

            // build up some queries to test
            Broker broker = JPAFacadeHelper.toBroker(em);
            org.apache.openjpa.kernel.Query q1 = broker
                .newQuery(JPQLParser.LANG_JPQL, "SELECT a FROM CacheObjectE a");

            q1.setCandidateExtent(broker.newExtent(CacheObjectE.class, false));
            iterate((Collection) q1.execute());
            assertInCache(q1, Boolean.TRUE);
View Full Code Here

            q1.setCandidateExtent(broker.newExtent(CacheObjectE.class, false));
            iterate((Collection) q1.execute());
            assertInCache(q1, Boolean.TRUE);

            org.apache.openjpa.kernel.Query q2 = broker
                .newQuery(JPQLParser.LANG_JPQL, "SELECT a FROM CacheObjectF a");
            iterate((Collection) q2.execute());
            assertInCache(q2, Boolean.TRUE);

            // if this run has a default timeout (set to 1 sec in the test
View Full Code Here

                attempts < 100);

            // build up a query that uses H in its access path...
            em = factory.createEntityManager();
            Broker broker = JPAFacadeHelper.toBroker(em);
            org.apache.openjpa.kernel.Query q = broker.newQuery(
                JPQLParser.LANG_JPQL, "Select a FROM "
                + CacheObjectJ.class.getSimpleName()
                + " a where a.str = 'h'");
            iterate((Collection) q.execute());
            assertInCache(q, Boolean.TRUE);
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.