Package org.apache.openjpa.kernel

Examples of org.apache.openjpa.kernel.Query.execute()


        Query q =
            broker.newQuery(JPQLParser.LANG_JPQL, "select a.stringColl FROM " +
                CacheObjectAChild1.class.getSimpleName() + " a");

        try {
            q.execute();
            fail("Allowed array projection query.");
        } catch (Exception e) {
        }
    }
View Full Code Here


        Broker broker = _factory.newBroker();
        Query q = broker.newQuery(JPQLParser.LANG_JPQL, "select a.cls FROM " +
            CacheObjectWithExternalizedFields.class.getSimpleName() + " a");

        q.setUnique(true);
        Object o = q.execute(); // get it in cache
        // ##### assertEquals (Class.class, o);
        CacheTestHelper.assertInCache(this, q, Boolean.FALSE);
    }

    public void testMutatedQueryReturnsNewResults() {
View Full Code Here

            broker.newQuery(JPQLParser.LANG_JPQL,
                "select a.name, max(a.age) FROM " +
                    CacheObjectAChild1.class.getSimpleName() +
                    " a group by a.name");

        List l = (List) q.execute();
        CacheTestHelper.iterate(l);
        CacheTestHelper.assertInCache(this, q, Boolean.TRUE);

        l = (List) q.execute();
        Object[] result = (Object[]) l.get(0);
View Full Code Here

        List l = (List) q.execute();
        CacheTestHelper.iterate(l);
        CacheTestHelper.assertInCache(this, q, Boolean.TRUE);

        l = (List) q.execute();
        Object[] result = (Object[]) l.get(0);
        assertEquals(2, result.length);
        assertEquals(String.class, result[0].getClass());
        assertEquals(Long.class, result[1].getClass());
View Full Code Here

        // now, mutate the query and see what happens
        q.setQuery("select max(a.age),a.name FROM " +
            CacheObjectAChild1.class.getSimpleName() + " a group by a.name");
        CacheTestHelper.assertInCache(this, q, Boolean.FALSE);
        l = (List) q.execute();
        result = (Object[]) l.get(0);
        assertEquals(2, result.length);
        assertEquals(Long.class, result[0].getClass());
        assertEquals(String.class, result[1].getClass());
        CacheTestHelper.iterate(l);
View Full Code Here

        assertEquals(Long.class, result[0].getClass());
        assertEquals(String.class, result[1].getClass());
        CacheTestHelper.iterate(l);
        CacheTestHelper.assertInCache(this, q, Boolean.TRUE);

        l = (List) q.execute();
        result = (Object[]) l.get(0);
        assertEquals(2, result.length);
        assertEquals(Long.class, result[0].getClass());
        assertEquals(String.class, result[1].getClass());
    }
View Full Code Here

    public void testNullRelatedPCIsCached() {
        Broker broker = _factory.newBroker();
        Query q = broker.newQuery(JPQLParser.LANG_JPQL, "select a.e FROM " +
            CacheObjectJ.class.getSimpleName() + " a where a.e is null");

        Collection c = (Collection) q.execute();
        CacheTestHelper.iterate(c);
        CacheTestHelper.assertInCache(this, q, Boolean.TRUE);

        c = (Collection) q.execute();
        assertNull(c.iterator().next());
View Full Code Here

        Collection c = (Collection) q.execute();
        CacheTestHelper.iterate(c);
        CacheTestHelper.assertInCache(this, q, Boolean.TRUE);

        c = (Collection) q.execute();
        assertNull(c.iterator().next());
    }

    public void testNullRelatedPCAndProjectionIsCached() {
        Broker broker = _factory.newBroker();
View Full Code Here

        Broker broker = _factory.newBroker();
        Query q =
            broker.newQuery(JPQLParser.LANG_JPQL, "select a.str,a.e FROM " +
                CacheObjectJ.class.getSimpleName() + " a where a.e is null");

        Collection c = (Collection) q.execute();
        CacheTestHelper.iterate(c);
        CacheTestHelper.assertInCache(this, q, Boolean.TRUE);

        c = (Collection) q.execute();
        Object[] result = (Object[]) c.iterator().next();
View Full Code Here

        Collection c = (Collection) q.execute();
        CacheTestHelper.iterate(c);
        CacheTestHelper.assertInCache(this, q, Boolean.TRUE);

        c = (Collection) q.execute();
        Object[] result = (Object[]) c.iterator().next();
        assertEquals(2, result.length);
        assertEquals(String.class, result[0].getClass());
        assertNull(result[1]);
    }
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.