Package org.apache.openjpa.persistence

Examples of org.apache.openjpa.persistence.OpenJPAEntityManagerFactory


    public void testAllowFlush2() {
        Map props = new HashMap();
        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


                stats.getWriteCount());
    }
   
    public void testMultipleUnits() {
        String[] props = {"openjpa.DataCache", "true", "openjpa.RemoteCommitProvider", "sjvm"};
        OpenJPAEntityManagerFactory emf1 = createNamedEMF("test", props);
        OpenJPAEntityManagerFactory emf2 = createNamedEMF("empty-pu", props);
        assertNotSame(emf1, emf2);
        assertNotSame(emf1.getStoreCache(), emf2.getStoreCache());
        assertNotSame(emf1.getStoreCache().getStatistics(), emf2.getStoreCache().getStatistics());
        assertNotSame(((StoreCacheImpl)emf1.getStoreCache()).getDelegate(),
                ((StoreCacheImpl)emf2.getStoreCache()).getDelegate());
       
    }
View Full Code Here

    public void testMemoryUse() throws Exception {

        System.out.println("Baseline, starting memory for N objects of " +
            NUM_OBJECTS);
        OpenJPAEntityManagerFactory kpmf =
            (OpenJPAEntityManagerFactory) getEmf();
        OpenJPAEntityManager kpm = (OpenJPAEntityManager)
            kpmf.createEntityManager();

        startTx(kpm);
        int runningId = performAddsModifiesDeletes(kpm, NUM_OBJECTS, 0);
        endTx(kpm);
View Full Code Here

        em = getPM();
        startTx(em);
    }

    public void testNonTransactionalWrite() throws Exception {
        OpenJPAEntityManagerFactory factory = broker();
        OpenJPAEntityManager em = factory.createEntityManager();
        OpenJPAQuery q = em.createQuery(
            "SELECT o FROM RuntimeTest1 o ORDER BY o.stringField ASC");
        q.setSubclasses(false);
        Collection c = (Collection) q.getResultList();
View Full Code Here

        id = pm2.getObjectId(a);
        endTx(pm2);

        Map props = new HashMap();
        props.put("openjpa.Multithreaded", "true");
        OpenJPAEntityManagerFactory pmf =
            (OpenJPAEntityManagerFactory) getEmf(props);
        pm = pmf.createEntityManager();
        startTx(pm);
    }
View Full Code Here

    public void doCleanUpTest(boolean commit) {
        Map<String, String> props = new HashMap<String, String>();
        props.put("openjpa.SavepointManager",
            TrackingSavepointManager.class.getName());
        OpenJPAEntityManagerFactory pmf = getEmf(props);
        OpenJPAEntityManager pm = pmf.createEntityManager();
        startTx(pm);
        pm.setSavepoint("test");
        pm.setSavepoint("test2");
        if (commit)
            endTx(pm);
View Full Code Here

    private void doOrderingTest(boolean rollback) {
        Map<String, String> props = new HashMap<String, String>();
        props.put("openjpa.SavepointManager",
            TrackingSavepointManager.class.getName());
        OpenJPAEntityManagerFactory pmf = getEmf(props);
        OpenJPAEntityManager pm = pmf.createEntityManager();
        startTx(pm);
        pm.setSavepoint("before");
        pm.setSavepoint("before2");
        pm.setSavepoint("test");
        pm.setSavepoint("test2");
View Full Code Here

    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

TOP

Related Classes of org.apache.openjpa.persistence.OpenJPAEntityManagerFactory

Copyright © 2018 www.massapicom. 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.