Package org.apache.openjpa.persistence

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


    public void testClearFetchGroups001() {
        OpenJPAEntityManagerFactory emf2 = createNamedEMF(getPersistenceUnitName(),
            FGManager.class, FGDepartment.class, FGEmployee.class, FGAddress.class,
            "openjpa.FetchGroups", "Default,DescFetchGroup");
       
        OpenJPAEntityManager em = emf2.createEntityManager();
        FetchPlan fp = em.getFetchPlan();
        assertNotNull(fp);
        assertNotNull(fp.getFetchGroups());
        assertEquals(2, fp.getFetchGroups().size());
        assertTrue(fp.getFetchGroups().contains("Default")); // Not the same as "default"
View Full Code Here


    public void testResetFetchGroups001() {
        OpenJPAEntityManagerFactory emf2 = createNamedEMF(getPersistenceUnitName(),
            FGManager.class, FGDepartment.class, FGEmployee.class, FGAddress.class,
            "openjpa.FetchGroups", "Default,DescFetchGroup");
       
        OpenJPAEntityManager em = emf2.createEntityManager();
        FetchPlan fp = em.getFetchPlan();
        assertNotNull(fp);
        assertNotNull(fp.getFetchGroups());
        assertEquals(2, fp.getFetchGroups().size());
        assertTrue(fp.getFetchGroups().contains("Default")); // Not the same as "default"
View Full Code Here

    public void testFinderCache004() {
        OpenJPAEntityManagerFactory emf2 = createNamedEMF(getPersistenceUnitName(),
            FGManager.class, FGDepartment.class, FGEmployee.class, FGAddress.class,
            "openjpa.FetchGroups", "default,DescFetchGroup");
       
        OpenJPAEntityManager em = emf2.createEntityManager();
        FetchPlan fp = em.getFetchPlan();
        assertNotNull(fp);
        assertNotNull(fp.getFetchGroups());
        assertEquals(2, fp.getFetchGroups().size());
        assertTrue(fp.getFetchGroups().contains("default"));
View Full Code Here

    public void testFinderCache005() {
        OpenJPAEntityManagerFactory emf2 = createNamedEMF(getPersistenceUnitName(),
            FGManager.class, FGDepartment.class, FGEmployee.class, FGAddress.class,
            "openjpa.FetchGroups", "default,DescFetchGroup");
       
        OpenJPAEntityManager em = emf2.createEntityManager();
        FetchPlan fp = em.getFetchPlan();
        assertNotNull(fp);
        assertNotNull(fp.getFetchGroups());
        assertEquals(2, fp.getFetchGroups().size());
        assertTrue(fp.getFetchGroups().contains("default"));
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

        //FIXME
        //PersistenceManagerFactory factory = getPMFactory(new String[]{
        //    "openjpa.RestoreMutableValues", "true",
        //});
        OpenJPAEntityManagerFactory factory =null;
        OpenJPAEntityManager pm = factory.createEntityManager();
        LRSPC pc = (LRSPC) pm.getObjectId(_oid);
        startTx(pm);
        pc.getStringCollection().remove("val2");
        pc.getStringCollection().add("val4");
        rollbackTx(pm);
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

        super(name);
    }

    public void testSchemaGen() throws Exception {
        OpenJPAEntityManagerFactory pmf = (OpenJPAEntityManagerFactory) getEmf();
        OpenJPAEntityManager pm = pmf.createEntityManager();
        JDBCConfiguration conf = (JDBCConfiguration) ((OpenJPAEntityManagerFactorySPI) pmf).getConfiguration();

        StringWriter sw = new StringWriter();

        SchemaTool.Flags flags = new SchemaTool.Flags();
View Full Code Here

        //FIXME jthomas
        //PersistenceManagerFactory factory = getPMFactory(new String[]{
          //  "openjpa.jdbc.SchemaFactory", "native(ForeignKeys=true)",
        //});
        OpenJPAEntityManagerFactory factory=null;
        OpenJPAEntityManager pm = factory.createEntityManager();
        startTx(pm);
       
       deleteAll( MappingTest1.class,pm);
       deleteAll( MappingTest2.class,pm);
        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.