Package org.apache.openjpa.persistence

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


    public void testLog() {
        Map map = getOrphanedKeyConfiguration("log(Level=FATAL)");

        OpenJPAEntityManagerFactory pmf = getEmf(map);
        OpenJPAEntityManager pm = pmf.createEntityManager();

        BufferedLogFactory logFactory = (BufferedLogFactory)
            ((OpenJPAEntityManagerSPI) pm).getConfiguration().getLogFactory();
        logFactory.clear();
View Full Code Here


    public void testException() {
        Map map = getOrphanedKeyConfiguration("exception");
        OpenJPAEntityManagerFactory pmf = getEmf(map);

        OpenJPAEntityManager pm = pmf.createEntityManager();

        BufferedLogFactory logFactory = (BufferedLogFactory)
            ((OpenJPAEntityManagerSPI) pm).getConfiguration().getLogFactory();
        logFactory.clear();
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

            .getConfiguration().getDataCacheManagerInstance()
            .getDataCacheScheduler().setInterval(1);
        DataCache cache = JPAFacadeHelper.getMetaData(emf,
            ScheduledEviction.class).getDataCache();

        OpenJPAEntityManager em = (OpenJPAEntityManager) emf
            .createEntityManager();
        startTx(em);
        ScheduledEviction pc = new ScheduledEviction("Foo");
        em.persist(pc);
        Object oid = em.getObjectId(pc);
View Full Code Here

        if (cal.get(Calendar.MINUTE) % 2 == 0)
            Thread.currentThread().sleep
                ((60 - cal.get(Calendar.SECOND)) * 1000);
        cal.setTime(new Date());
        assertTrue(cal.get(Calendar.MINUTE) % 2 == 1);
        em = (OpenJPAEntityManager) emf.createEntityManager();
        em.find(ScheduledEviction.class, oid);
        endEm(em);
        assertTrue(cache.contains(oidwithclass));

        Thread.currentThread().sleep(130 * 1000);
 
View Full Code Here

        // wait a bit so they get stored
        pause(1);

        OpenJPAEntityManager pm2;
        pm2 = (OpenJPAEntityManager) pmfReceiver.createEntityManager();
        performLoadAll(pm2);
        endEm(pm2);

        pmSender = (OpenJPAEntityManager) pmfSender.createEntityManager();
        performLoadAll(pmSender);
View Full Code Here

       
        OpenJPAEntityManagerFactory factory =(OpenJPAEntityManagerFactory)
                getEmf(props);

        commitOccurred = false;
        OpenJPAEntityManager pm = factory.createEntityManager();    
       
        pm.getTransaction().begin();
        assertFalse(commitOccurred);
        pm.persist(new RuntimeTest1("Listener test", 99));
        pm.getTransaction().commit();
View Full Code Here

   
    public void testSchemaGen()
    throws Exception {
        OpenJPAEntityManagerFactory pmf = (OpenJPAEntityManagerFactory)
        getEmf();
        OpenJPAEntityManager pm = pmf.createEntityManager();
        JDBCConfiguration con = (JDBCConfiguration) ((OpenJPAEntityManagerSPI) pm).getConfiguration();
        DBDictionary dict = con.getDBDictionaryInstance();
        MappingRepository repos = con.getMappingRepositoryInstance();
        ClassMapping cm = repos.getMapping(RuntimeTest1.class,
                pm.getClassLoader(), true);
View Full Code Here

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

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.