Package org.apache.openjpa.conf

Examples of org.apache.openjpa.conf.Compatibility


        (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
            createEntityManagerFactory("persistence_1_0",
                "org/apache/openjpa/persistence/compat/" +
                "persistence_1_0.xml");

        Compatibility compat = emf.getConfiguration().getCompatibilityInstance();
        assertTrue(compat.getFlushBeforeDetach());
        assertTrue(compat.getCopyOnDetach());
        assertTrue(compat.getPrivatePersistentProperties());
        String vMode = emf.getConfiguration().getValidationMode();
        assertEquals("NONE", vMode);
        Specification spec = emf.getConfiguration().getSpecificationInstance();
        assertEquals("JPA", spec.getName().toUpperCase());
        assertEquals(spec.getVersion(), 1);
View Full Code Here


        (OpenJPAEntityManagerFactorySPI)OpenJPAPersistence.
            createEntityManagerFactory("persistence_2_0",
                "org/apache/openjpa/persistence/compat/" +
                "persistence_2_0.xml");

        Compatibility compat = emf.getConfiguration().getCompatibilityInstance();
        assertFalse(compat.getFlushBeforeDetach());
        assertFalse(compat.getCopyOnDetach());
        assertFalse(compat.getPrivatePersistentProperties());
        String vMode = emf.getConfiguration().getValidationMode();
        assertEquals("AUTO", vMode);
        Specification spec = emf.getConfiguration().getSpecificationInstance();
        assertEquals("JPA", spec.getName().toUpperCase());
        assertEquals(spec.getVersion(), 2);
View Full Code Here

            _fullFM = new DetachFieldManager();
        } else {
            _detached = new IdentityMap();
            _fullFM = null;
        }
        Compatibility compatibility =
            broker.getConfiguration().getCompatibilityInstance();
        _flushBeforeDetach = compatibility.getFlushBeforeDetach();
        _reloadOnDetach = compatibility.getReloadOnDetach();
        _cascadeWithDetach = compatibility.getCascadeWithDetach();
        if (full) {
            _copy = false;
        }
        else {
            _copy = compatibility.getCopyOnDetach();;
        }
    }
View Full Code Here

    public void setUp() {
        setUp(DROP_TABLES, Entity20.class);
        log = emf.getConfiguration().getLog("test");
       
        // check and set Compatibility values to new 2.0 values
        Compatibility compat = emf.getConfiguration().getCompatibilityInstance();
        assertNotNull(compat);
        if (log.isTraceEnabled()) {
            log.trace("Before set, FlushBeforeDetach=" + compat.getFlushBeforeDetach());
            log.trace("Before set, CopyOnDetach=" + compat.getCopyOnDetach());
            log.trace("Before set, CascadeWithDetach=" + compat.getCascadeWithDetach());
        }
        compat.setFlushBeforeDetach(false);
        compat.setCopyOnDetach(false);
        compat.setCascadeWithDetach(false);
        if (log.isTraceEnabled()) {
            log.trace("After set, FlushBeforeDetach=" + compat.getFlushBeforeDetach());
            log.trace("After set, CopyOnDetach=" + compat.getCopyOnDetach());
            log.trace("After set, CascadeWithDetach=" + compat.getCascadeWithDetach());
        }
        createEntities(numEntities);
    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public <T> T detachCopy(T entity) {
        assertNotCloseInvoked();
        Compatibility compat = this.getConfiguration().
            getCompatibilityInstance();
        boolean copyOnDetach = compat.getCopyOnDetach();
        boolean cascadeWithDetach = compat.getCascadeWithDetach();
        // Set compatibility options to get 1.x detach behavior
        compat.setCopyOnDetach(true);
        compat.setCascadeWithDetach(true);
        try {
            T t = (T)_broker.detach(entity, this);
            return t;
        } finally {
            // Reset compatibility options
            compat.setCopyOnDetach(copyOnDetach);
            compat.setCascadeWithDetach(cascadeWithDetach);
        }       
    }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.conf.Compatibility

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.