Package org.apache.openjpa.persistence

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


        //q.setUnique(true);
        pc = (MappedByMapPC) q.getSingleResult();
        assertEquals(3, pc.getHelpers().size());
        assertEquals(h2, pc.getHelpers().get("h2"));
       
        q = pm.createNativeQuery("helpers.containsValue (:h2)",pc.getClass());
        //FIXME  jthomas
        //q.setUnique(true);
        pc = (MappedByMapPC) q.getSingleResult();
        assertEquals(3, pc.getHelpers().size());
        assertEquals(h2, pc.getHelpers().get("h2"));
View Full Code Here


        OpenJPAEntityManager readPM = getPM(true, false);
        startTx(readPM);

        assertSize(0, flushPM.createNativeQuery("stringField == '" + name + "'",
            ModRuntimeTest1.class));
        assertSize(0, readPM.createNativeQuery("stringField == '" + name + "'",
            ModRuntimeTest1.class));

        ModRuntimeTest1 a = new ModRuntimeTest1(name, randomInt().intValue());

        flushPM.persist(a);
View Full Code Here

        ModRuntimeTest1 a = new ModRuntimeTest1(name, randomInt().intValue());

        flushPM.persist(a);

        assertSize(0, readPM.createNativeQuery("name == '" + name + "'",
            ModRuntimeTest1.class));

        flushPM.flush();

        // make sure the other pm doesn't see the flushed object
View Full Code Here

            ModRuntimeTest1.class));

        flushPM.flush();

        // make sure the other pm doesn't see the flushed object
        assertSize(0, readPM.createNativeQuery("name == '" + name + "'",
            ModRuntimeTest1.class));

        flushPM.remove(a);

        assertSize(0, flushPM.createNativeQuery("name == '" + name + "'",
View Full Code Here

        flushPM.remove(a);

        assertSize(0, flushPM.createNativeQuery("name == '" + name + "'",
            ModRuntimeTest1.class));
        assertSize(0, readPM.createNativeQuery("name == '" + name + "'",
            ModRuntimeTest1.class));

        endTx(flushPM);
        endEm(flushPM);
View Full Code Here

            assertEquals("PU provided query timeout", setTime.intValue(),
                conf.getQueryTimeout());
            // create EM and Query
            em = emf.createEntityManager();
            assertNotNull(em);
            OpenJPAQuery q = em.createNativeQuery(nativeUpdateStr);
            q.setParameter(1, new String("updated"));
            // verify no default javax.persistence.query.timeout is supplied
            Map<String, Object> hints = q.getHints();
            assertFalse(hints.containsKey("javax.persistence.query.timeout"));
            // verify internal config values were updated
View Full Code Here

            // Following fails to cause a SQLException, but takes 2+ secs
            // Query q = em.createNativeQuery("INSERT INTO QTimeout (id, " +
            //    "stringField) VALUES (?,?)");
            // q.setParameter(1, 99);
            // q.setParameter(2, new String("inserted"));
            OpenJPAQuery q = em.createNativeQuery(nativeUpdateStr);
            q.setParameter(1, new String("updated"));
            // verify no default javax.persistence.query.timeout is supplied
            Map<String, Object> hints = q.getHints();
            assertFalse(hints.containsKey("javax.persistence.query.timeout"));
            // update the query timeout value and verify it was set
View Full Code Here

            assertEquals("PU provided query timeout", setTime.intValue(),
                conf.getQueryTimeout());
            // create EM and Query
            em = emf.createEntityManager();
            assertNotNull(em);
            OpenJPAQuery q = em.createNativeQuery(nativeUpdateStr);
            q.setParameter(1, new String("updated"));
            // verify no default javax.persistence.query.timeout is supplied
            Map<String, Object> hints = q.getHints();
            assertFalse(hints.containsKey("javax.persistence.query.timeout"));
            // verify internal config values were updated
View Full Code Here

            // Following fails to cause a SQLException, but takes 2+ secs
            // Query q = em.createNativeQuery("INSERT INTO QTimeout (id, " +
            //    "stringField) VALUES (?,?)");
            // q.setParameter(1, 99);
            // q.setParameter(2, new String("inserted"));
            OpenJPAQuery q = em.createNativeQuery(nativeUpdateStr);
            q.setParameter(1, new String("updated"));
            // verify no default javax.persistence.query.timeout is supplied
            Map<String, Object> hints = q.getHints();
            assertFalse(hints.containsKey("javax.persistence.query.timeout"));
            // update the query timeout value and verify it was set
View Full Code Here

    }

    public void testProjections()
        throws Exception {
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        OpenJPAQuery q = pm.createNativeQuery("",Relations.class);
        //FIXME jthomas
        /*
        q.setResult("base, baseSub1, baseSub1Sub2");
        q.setUnique(true);
        Object[] res = (Object[]) 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.