Package org.apache.openjpa.persistence

Examples of org.apache.openjpa.persistence.OpenJPAEntityManager.createQuery()


    public void testBeginRange() {
        OpenJPAEntityManager em =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(em);

        OpenJPAQuery q = em.createQuery(
            "SELECT r FROM RuntimeTest1 r ORDER BY r.stringField ASC");
        q.setSubclasses(false);
        for (int i = 0; i < 4; i++) {
            q.setFirstResult(i);
            q.setMaxResults(100000);
View Full Code Here


    public void testBeginRangeSubs() {
        OpenJPAEntityManager em =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(em);

        OpenJPAQuery q = em.createQuery(
            "SELECT r FROM RuntimeTest1 r ORDER BY r.stringField ASC");

        for (int i = 0; i < 7; i++) {
            q.setFirstResult(i);
            Long l = new Long(Long.MAX_VALUE);
View Full Code Here

    public void testEndRange() {
        OpenJPAEntityManager em =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(em);

        OpenJPAQuery q = em.createQuery(
            "SELECT r FROM RuntimeTest1 r ORDER BY r.stringField ASC");
        q.setSubclasses(false);

        for (int i = 0; i < 4; i++) {
            q.setFirstResult(0);
View Full Code Here

    public void testEndRangeSubs() {
        OpenJPAEntityManager em =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(em);

        OpenJPAQuery q = em.createQuery(
            "SELECT r FROM RuntimeTest1 r ORDER BY r.stringField ASC");

        for (int i = 0; i < 7; i++) {
            q.setFirstResult(0);
            q.setMaxResults(i);
View Full Code Here

    public void testMidRange() {
        OpenJPAEntityManager em =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(em);

        OpenJPAQuery q = em.createQuery(
            "SELECT r FROM RuntimeTest1 r ORDER BY r.stringField ASC");
        q.setSubclasses(false);

        q.setFirstResult(1);
        q.setMaxResults(3);
View Full Code Here

    public void testMidRangeSubs() {
        OpenJPAEntityManager em =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(em);

        OpenJPAQuery q = em.createQuery(
            "SELECT r FROM RuntimeTest1 r ORDER BY r.stringField ASC");
        q.setFirstResult(1);
        q.setMaxResults(3);

        List res = (List) q.getResultList();
View Full Code Here

        // interfere with FOR UPDATE
        OpenJPAEntityManager em =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(em);

        OpenJPAQuery q = em.createQuery(
            "SELECT r FROM RuntimeTest1 r ORDER BY r.stringField ASC");
        q.setSubclasses(false);
        q.setFirstResult(0);
        q.setMaxResults(2);
View Full Code Here

    public void testMixedQuery() {
        createMixed();

        OpenJPAEntityManager em = emf.createEntityManager();
        Query q = em.createQuery("select o from MixedInterface o " +
            "where o.intField = 4");
        Collection c = q.getResultList();
        Set seen = new HashSet();
        assertEquals(2, c.size());
        MixedInterface pc;
View Full Code Here

    public void testQueryForMixedInterfaceImpls() {
        createMixed();

        OpenJPAEntityManager em = emf.createEntityManager();
        Query q = em.createQuery("select o from MixedInterfaceImpl o " +
            "where o.intField = 4");
        MixedInterface pc = (MixedInterface) q.getSingleResult();
        assertEquals(4, pc.getIntField());
        assertTrue(pc instanceof MixedInterfaceImpl);
        em.close();
View Full Code Here

        {
            OpenJPAEntityManager pm = getPM();
            startTx(pm);
            String theQuery =
                "SELECT r FROM RuntimeTest1 r WHERE r.stringField = \'testSimple\'";
            OpenJPAQuery query = pm.createQuery(theQuery);
            List list = query.getResultList();
            assertSize(1, list);
            endTx(pm);
            endEm(pm);
        }
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.