Package org.apache.openjpa.persistence

Examples of org.apache.openjpa.persistence.OpenJPAEntityManagerFactory.createEntityManager()


    public void testDisallowFlush() {
        Map<String, String> props = new HashMap<String, String>();
        props.put("openjpa.SavepointManager",
            TrackingSavepointManager.class.getName() + "(AllowFlush=false)");
        OpenJPAEntityManagerFactory pmf = getEmf(props);
        OpenJPAEntityManager pm = pmf.createEntityManager();
        startTx(pm);
        pm.persist(new RuntimeTest1());
        pm.setSavepoint("a");
        try {
            pm.flush();
View Full Code Here


    public void testDisallowFlush2() {
        Map<String, String> props = new HashMap<String, String>();
        props.put("openjpa.SavepointManager",
            TrackingSavepointManager.class.getName() + "(AllowFlush=false)");
        OpenJPAEntityManagerFactory pmf = getEmf(props);
        OpenJPAEntityManager pm = pmf.createEntityManager();

        startTx(pm);
        pm.persist(new RuntimeTest1());
        pm.flush();
        try {
View Full Code Here

    public void testAllowFlush() {
        Map<String, String> props = new HashMap<String, String>();
        props.put("openjpa.SavepointManager",
            TrackingSavepointManager.class.getName() + "(AllowFlush=true)");
        OpenJPAEntityManagerFactory pmf = getEmf(props);
        OpenJPAEntityManager pm = pmf.createEntityManager();

        startTx(pm);
        pm.persist(new RuntimeTest1());
        pm.setSavepoint("a");
        try {
View Full Code Here

    public void testAllowFlush2() {
        Map<String, String> props = new HashMap<String, String>();
        props.put("openjpa.SavepointManager",
            TrackingSavepointManager.class.getName() + "(AllowFlush=true)");
        OpenJPAEntityManagerFactory pmf = getEmf(props);
        OpenJPAEntityManager pm = pmf.createEntityManager();

        startTx(pm);
        pm.persist(new RuntimeTest1());
        pm.flush();
        try {
View Full Code Here

            assertEquals("Expected no default lock timeout", lTime.intValue(),
                conf1.getLockTimeout());
            assertEquals("Expected no default query timeout", qTime.intValue(),
                conf1.getQueryTimeout());
            // verify Query receives no properties
            em1 = emf1.createEntityManager();
            assertNotNull(em1);
            q = em1.createNamedQuery("NoHintList");
            // verify no Query hints
            hints = q.getHints();
            assertFalse(hints.containsKey("javax.persistence.lock.timeout"));
View Full Code Here

            assertEquals("Default PU lock timeout", lTime.intValue(),
                conf1.getLockTimeout());
            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
View Full Code Here

        emf.close();
        OpenJPAEntityManagerFactory emf = createEMF(
            getManagedType(), getSecondaryType(),
            "openjpa.EntityManagerFactoryPool", "true",
            "openjpa.SavepointManager", "in-mem");
        OpenJPAEntityManager em = emf.createEntityManager();
        OpenJPAEntityManager em2 = null;
        try {
            em.getTransaction().begin();
            T t = newManagedInstance();
            Object orig = getModifiedValue(t);
View Full Code Here

        emf.close();
        OpenJPAEntityManagerFactory emf = createEMF(
            getManagedType(), getSecondaryType(),
            "openjpa.EntityManagerFactoryPool", "true",
            "openjpa.SavepointManager", "in-mem");
        OpenJPAEntityManager em = emf.createEntityManager();
        OpenJPAEntityManager em2 = null;
        try {
            em.getTransaction().begin();
            T t = em.find(getManagedType(), id);
            Object orig = getModifiedValue(t);
View Full Code Here

    public void testFetchGroupsFromConfiguration() {
        Map props = new HashMap();
        props.put("openjpa.FetchGroups", "default,fg1,fg2");
        OpenJPAEntityManagerFactory factory = getEmf(props);

        OpenJPAEntityManager pm = factory.createEntityManager();
        checkGroups(pm, new String[]{ "fg1", "fg2" });
        factory.close();
    }

    public void testFetchGroupsNoConfiguration() {
View Full Code Here

        Map props = new HashMap();
        props.put("openjpa.ConnectionRetainMode", mode);

        OpenJPAEntityManagerFactory factory = getEmf(props);
        OpenJPAEntityManager pm =
            (OpenJPAEntityManager) factory.createEntityManager();
        Object initialConnection = pm.getConnection();

        try {
            checkPM(pm, initialConnection, mode);
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.