Package org.apache.openjpa.persistence

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


        assertContains(log.lines, "    NamedQueryEntity.namedQuery");
        clear(emf);
        closeEMF(emf);

        emf = createEMF(LOAD_PROPS);
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        em.persist(new NamedQueryEntity("foo"));
        em.flush();
        Query q = em.createNamedQuery("NamedQueryEntity.namedQuery");
        assertEquals(1, q.getResultList().size());
View Full Code Here


            (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
            createEntityManagerFactory("Access-XML",
            "org/apache/openjpa/persistence/access/" +
            "access-persistence.xml");

        OpenJPAEntityManagerSPI em = emf1.createEntityManager();

        XMLPropertySub ps = new XMLPropertySub();
        // Call super setter with underlying field access
        ps.setName("AbsMappedSuperName");
        // Call base setter with property access
View Full Code Here

            (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
            createEntityManagerFactory("Access-XML",
            "org/apache/openjpa/persistence/access/" +
            "access-persistence.xml");

        OpenJPAEntityManagerSPI em = emf1.createEntityManager();
       
        XMLFieldSub fs = new XMLFieldSub();
        // Call super setter with underlying field access
        fs.setName("AbsMappedSuperName");
        // Call base setter with property access
View Full Code Here

            (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
            createEntityManagerFactory("Access-XML",
            "org/apache/openjpa/persistence/access/" +
            "access-persistence.xml");

        OpenJPAEntityManagerSPI em = emf1.createEntityManager();
       
        XMLPropertySub2 ps = new XMLPropertySub2();
        // Call super setter with underlying field access
        ps.setName("MappedSuperName");
        // Call base setter with property access
View Full Code Here

        assertNotNull(inst);
        assertTrue(inst instanceof DataCacheInstrument);
        DataCacheInstrument dci = (DataCacheInstrument)inst;
        assertEquals(dci.getCacheName(), "default");
       
        OpenJPAEntityManagerSPI oem = oemf.createEntityManager();
       
        CacheableEntity ce = new CacheableEntity();
        int id = new Random().nextInt();
        ce.setId(id);
       
View Full Code Here

    }
   
    public void testUpdateNoEvict(){
        OpenJPAEntityManagerFactorySPI emf = createNamedEMF(getPersistenceUnitName(), noEvictProps);
        Cache cache = emf.getCache();
        OpenJPAEntityManagerSPI em = emf.createEntityManager();
        try {
            CachedEntityStatistics e = createEntity(em);
            assertTrue(cache.contains(CachedEntityStatistics.class, e.getId()));
            em.clear();
View Full Code Here

    }

    public void testDeleteNoEvict() throws Exception {
        OpenJPAEntityManagerFactorySPI emf = createNamedEMF(getPersistenceUnitName(), noEvictProps);
        Cache cache = emf.getCache();
        OpenJPAEntityManagerSPI em = emf.createEntityManager();
        try {
            CachedEntityStatistics e = createEntity(em);
            assertTrue(cache.contains(CachedEntityStatistics.class, e.getId()));
            em.clear();
View Full Code Here

        props.put("openjpa.jdbc.QuerySQLCache", "true");

        OpenJPAEntityManagerFactorySPI emf1 = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.
                                             cast(Persistence.createEntityManagerFactory("test", props));
        try {
            EntityManagerImpl em = (EntityManagerImpl)emf1.createEntityManager();
   
            em.getTransaction().begin();
   
            for (int i = 1; i < 3; i++) {
                TblParent p = new TblParent();
View Full Code Here

        types.add(EntityB.class);
        types.add(MappedSuper.class);
        OpenJPAEntityManagerFactorySPI emf = createEMF2_0(types);
        EntityManager em = null;
        try {
            em = emf.createEntityManager();
            EntityA a = new EntityA();
            a.setId(1);
            EntityB b = new EntityB();
            b.setId(1);
            a.setEntityB(b);
View Full Code Here

        types.add(Bi_1ToM_FK.class);
        types.add(Bi_1ToM_JT.class);
        types.add(Uni_1ToM_FK.class);
        types.add(Uni_1ToM_JT.class);
        OpenJPAEntityManagerFactorySPI emf = createEMF2_0(types);
        EntityManager em = emf.createEntityManager();
       
        try {
            // trigger table creation
            em.getTransaction().begin();
            em.getTransaction().commit();
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.