Package org.apache.openjpa.persistence.simple

Examples of org.apache.openjpa.persistence.simple.Person


        DelegatingStoreManager dstore = broker.getStoreManager();
        JDBCStoreManager jstore =
            (JDBCStoreManager)dstore.getInnermostDelegate();

        em.getTransaction().begin();
        Person p = new Person();
        p.setId(1);
        em.persist(p);
        em.flush();
        em.getTransaction().commit();
       
        Person p1 = em.find(Person.class, 1);
        Map sqlCache = jstore.getQuerySQLCache();
        Set keys = sqlCache.keySet();
        for (Iterator iter = keys.iterator(); iter.hasNext();) {
            Map cacheMap = (Map) iter.next();
            //make sure there is an entry in the cache
View Full Code Here


        DelegatingStoreManager dstore = broker.getStoreManager();
        JDBCStoreManager jstore =
            (JDBCStoreManager)dstore.getInnermostDelegate();
       
        em.getTransaction().begin();
        Person p = new Person();
        p.setId(1);
        em.persist(p);
        em.flush();
        em.getTransaction().commit();
       
        Person p1 = em.find(Person.class, 1);
        Map sqlCache = jstore.getQuerySQLCache();
        Set keys = sqlCache.keySet();
        for (Iterator iter = keys.iterator(); iter.hasNext();) {
            Map cacheMap = (Map) iter.next();
            //make sure there is an entry in the cache
View Full Code Here

        DelegatingStoreManager dstore = broker.getStoreManager();
        JDBCStoreManager jstore =
            (JDBCStoreManager)dstore.getInnermostDelegate();
       
        em.getTransaction().begin();
        Person p = new Person();
        p.setId(1);
        em.persist(p);
        em.flush();
        em.getTransaction().commit();
       
        Person p1 = em.find(Person.class, 1);

        assertFalse(jstore.isQuerySQLCacheOn());
       
        em.getTransaction().begin();
        em.remove(p);
View Full Code Here

        DelegatingStoreManager dstore = broker.getStoreManager();
        JDBCStoreManager jstore =
            (JDBCStoreManager)dstore.getInnermostDelegate();
       
        em.getTransaction().begin();
        Person p = new Person();
        p.setId(1);
        em.persist(p);
        em.flush();
        em.getTransaction().commit();
       
        Person p1 = em.find(Person.class, 1);

        assertTrue(jstore.isQuerySQLCacheOn());

        Map sqlCache = jstore.getQuerySQLCache();
        Set keys = sqlCache.keySet();
View Full Code Here

        // Create some entities
        em.getTransaction().begin();
        for (int i = 0; i < nPeople; i++)
        {
            Person p = new Person();
            p.setId(i);
            em.persist(p);
        }
        em.flush();
        em.getTransaction().commit();
        em.close();

        Thread[] newThreads = new Thread[nThreads];
        FindPeople[] customer = new FindPeople[nThreads];
       
        for (int i=0; i < nThreads; i++) {
            customer[i] = new FindPeople(emfac, 0, nPeople,
                nIterations, i);
            newThreads[i] = new Thread(customer[i]);
            newThreads[i].start();
        }
       
        // Wait for the worker threads to complete
        for (int i = 0; i < nThreads; i++) {
            try {
                newThreads[i].join();
            } catch (InterruptedException e) {
                this.fail("Caught Interrupted Exception: " + e);
            }
        }  

        // Run through the state of all runnables to assert if any of them
        // failed.
        for (int i = 0; i < nThreads; i++) {
            assertFalse(customer[i].hadFailures());
        }

        // Clean up the entities used in this test
        em = emfac.createEntityManager();           
        em.getTransaction().begin();

        for (int i = 0; i < nPeople; i++) {
            Person p = em.find(Person.class, i);
            em.remove(p);
        }
        em.flush();
        em.getTransaction().commit();
        em.close();
View Full Code Here

            try {           
                EntityManager em = emf.createEntityManager();           
                for (int j = 0; j < iterations; j++) {
                   
                    for (int i = startId; i < endId; i++) {
                        Person p1 = em.find(Person.class, i);
                        if (p1.getId() != i) {
                            System.out.println("Finder failed: " + i);
                            failures = true;
                            break;
                        }                   
                    }
View Full Code Here

        DelegatingStoreManager dstore = broker.getStoreManager();
        JDBCStoreManager jstore =
            (JDBCStoreManager)dstore.getInnermostDelegate();

        em.getTransaction().begin();
        Person p = new Person();
        p.setId(1);
        em.persist(p);
        em.flush();
        em.getTransaction().commit();
       
        Person p1 = em.find(Person.class, 1);
        Map sqlCache = jstore.getQuerySQLCache();
        Set keys = sqlCache.keySet();
        for (Iterator iter = keys.iterator(); iter.hasNext();) {
            Map cacheMap = (Map) iter.next();
            //make sure there is an entry in the cache
View Full Code Here

        DelegatingStoreManager dstore = broker.getStoreManager();
        JDBCStoreManager jstore =
            (JDBCStoreManager)dstore.getInnermostDelegate();
       
        em.getTransaction().begin();
        Person p = new Person();
        p.setId(1);
        em.persist(p);
        em.flush();
        em.getTransaction().commit();
       
        Person p1 = em.find(Person.class, 1);
        Map sqlCache = jstore.getQuerySQLCache();
        Set keys = sqlCache.keySet();
        for (Iterator iter = keys.iterator(); iter.hasNext();) {
            Map cacheMap = (Map) iter.next();
            //make sure there is an entry in the cache
View Full Code Here

        DelegatingStoreManager dstore = broker.getStoreManager();
        JDBCStoreManager jstore =
            (JDBCStoreManager)dstore.getInnermostDelegate();
       
        em.getTransaction().begin();
        Person p = new Person();
        p.setId(1);
        em.persist(p);
        em.flush();
        em.getTransaction().commit();
       
        Person p1 = em.find(Person.class, 1);

        assertFalse(jstore.isQuerySQLCacheOn());
       
        em.getTransaction().begin();
        em.remove(p);
View Full Code Here

        DelegatingStoreManager dstore = broker.getStoreManager();
        JDBCStoreManager jstore =
            (JDBCStoreManager)dstore.getInnermostDelegate();
       
        em.getTransaction().begin();
        Person p = new Person();
        p.setId(1);
        em.persist(p);
        em.flush();
        em.getTransaction().commit();
       
        Person p1 = em.find(Person.class, 1);

        assertTrue(jstore.isQuerySQLCacheOn());

        Map sqlCache = jstore.getQuerySQLCache();
        Set keys = sqlCache.keySet();
View Full Code Here

TOP

Related Classes of org.apache.openjpa.persistence.simple.Person

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.