Package org.apache.openjpa.persistence

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


            assertEquals("Default PU query timeout.", qTime.intValue(),
                conf1.getQueryTimeout());
            // verify Query receives the properties
            em1 = emf1.createEntityManager();
            assertNotNull(em1);
            q = em1.createNamedQuery("NoHintList");   
            // Cannot verify properties are passed through as Query hints
            //     See explanation and commented out test in testNoProperties()
            // verify timeout properties supplied in persistence.xml
            timeout = q.getFetchPlan().getLockTimeout();
            assertEquals("Expected default PU lock timeout", lTime.intValue(),
View Full Code Here


                conf.getQueryTimeout());
            // verify no default javax.persistence.query.timeout is supplied
            // as the Map properties are not passed through as hints
            em = emf.createEntityManager();
            assertNotNull(em);
            OpenJPAQuery q = em.createNamedQuery("NoHintSingle");
            Map<String, Object> hints = q.getHints();
            assertFalse(hints.containsKey("javax.persistence.query.timeout"));
            // verify internal config values were updated
            assertEquals("Map provided query timeout", setTime.intValue(),
                q.getFetchPlan().getQueryTimeout());
View Full Code Here

        endEm(pm);
    }

    public void testNamespace() {
        OpenJPAEntityManager pm = getEM();
        OpenJPAQuery query = (OpenJPAQuery) pm.createNamedQuery("named");
        assertEquals("SELECT o FROM QueryTest1 o", query.getQueryString());
        query.closeAll();
        endEm(pm);
    }
View Full Code Here

    public void testSystemJDOQL() {
        // make sure local query metadata is parsed
        OpenJPAEntityManager pm = getEM();

        OpenJPAQuery query = (OpenJPAQuery) pm.createNamedQuery("named");
        assertEquals("SELECT o FROM QueryTest1 o", query.getQueryString());
        assertEquals(QueryTest1.class, query.getResultClass());
        assertEquals(10, ((Collection) query.getResultList()).size());
        query.closeAll();
        endEm(pm);
View Full Code Here

            assertEquals("Map provided query timeout", setTime.intValue(),
                conf.getQueryTimeout());
            // create EM and named query
            em = emf.createEntityManager();
            assertNotNull(em);
            OpenJPAQuery q = em.createNamedQuery("Hint1000msec");
            setTime = 1000;
            // verify javax.persistence.query.timeout hint via annotation set
            Map<String, Object> hints = q.getHints();
            assertTrue(hints.containsKey("javax.persistence.query.timeout"));
            Integer timeout = new Integer((String) hints.get(
View Full Code Here

    public void process() throws ProcessingException {
        JPAServletContext ctx = getExecutionContext();
        String spec = getMandatoryArgument(ARG_QUERY);
        OpenJPAEntityManager em = ctx.getPersistenceContext();
        try {
            Query query = isBooleanQualifier(QUALIFIER_NAMED) ? em.createNamedQuery(spec) : em.createQuery(spec);
            if (hasQualifier(QUALIFIER_FIRSTRESULT))
                query.setFirstResult(Integer.parseInt(getQualifier(QUALIFIER_FIRSTRESULT)));
            if (hasQualifier(QUALIFIER_MAXRESULT))
                query.setMaxResults(Integer.parseInt(getQualifier(QUALIFIER_MAXRESULT)));
            pushFetchPlan(query);
View Full Code Here

                conf.getQueryTimeout());
            // verify no default javax.persistence.query.timeout is supplied
            // as the Map properties are not passed through as hints
            em = emf.createEntityManager();
            assertNotNull(em);
            OpenJPAQuery q = em.createNamedQuery("NoHintSingle");
            Map<String, Object> hints = q.getHints();
            assertFalse(hints.containsKey("javax.persistence.query.timeout"));
            // verify internal config values were updated
            assertEquals("Map provided query timeout", setTime.intValue(),
                q.getFetchPlan().getQueryTimeout());
View Full Code Here

            assertEquals("Map provided query timeout", setTime.intValue(),
                conf.getQueryTimeout());
            // create EM and named query
            em = emf.createEntityManager();
            assertNotNull(em);
            OpenJPAQuery q = em.createNamedQuery("Hint1000msec");
            setTime = 1000;
            // verify javax.persistence.query.timeout hint via annotation set
            Map<String, Object> hints = q.getHints();
            assertTrue(hints.containsKey("javax.persistence.query.timeout"));
            Integer timeout = new Integer((String) hints.get(
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.