Package org.apache.openjpa.conf

Examples of org.apache.openjpa.conf.Compatibility


    }

    @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


            _fullFM = new DetachFieldManager();
        } else {
            _detached = new IdentityMap();
            _fullFM = null;
        }
        Compatibility compatibility =
            broker.getConfiguration().getCompatibilityInstance();
        _flushBeforeDetach = compatibility.getFlushBeforeDetach();
        _reloadOnDetach = compatibility.getReloadOnDetach();
    }
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

            // metadata
            if (sm instanceof DetachedStateManager) {
                useDSFForUnproxy = ((DetachedStateManager) sm).getUseDSFForUnproxy();
            } else{
                // DetachedStateManager has no context or metadata, so we can't get configuration settings
                Compatibility compat = null;
                meta = sm.getMetaData();
                if (meta != null) {
                    compat = meta.getRepository().getConfiguration().getCompatibilityInstance();
                } else if (sm.getContext() != null && sm.getContext().getConfiguration() != null) {
                    compat = sm.getContext().getConfiguration().getCompatibilityInstance();
                } else {
                    // no-op - using a StateManager, but no Compatibility settings available
                }
                if (compat != null) {
                    // new 2.0 behavior of using DetachedStateField to determine unproxy during serialization
                    useDSFForUnproxy = !compat.getIgnoreDetachedStateFieldForProxySerialization();
                }
            }
           
            if (useDSFForUnproxy) {
                // use new 2.0 behavior
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

        if (multithreaded)
            _lock = new ReentrantLock();
        else
            _lock = null;
        if (sm.getContext() != null && sm.getContext().getConfiguration() != null) {
            Compatibility compat = sm.getContext().getConfiguration().getCompatibilityInstance();
            if (compat != null && !compat.getIgnoreDetachedStateFieldForProxySerialization())
                _useDSFForUnproxy = true;      // new 2.0 behavior
            else
                _useDSFForUnproxy = false;
        } else
            _useDSFForUnproxy = false;
View Full Code Here

            DMCustomerInventory.class, DMItem.class, CLEAR_TABLES };

    public void setUp() {
        super.setUp(props);

        Compatibility compat = emf.getConfiguration().getCompatibilityInstance();
        compat.setCopyOnDetach(false);
        compat.setFlushBeforeDetach(false);
        em = emf.createEntityManager();
        root = createData();
    }
View Full Code Here

   
    public void setUp() {
        super.setUp(DMCustomer.class, DMCustomerInventory.class, DMItem.class,
            CLEAR_TABLES);
       
        Compatibility compat =
            emf.getConfiguration().getCompatibilityInstance();
        compat.setCopyOnDetach(false);
        compat.setFlushBeforeDetach(false);
       
        em = emf.createEntityManager();
        root = createData();
    }
View Full Code Here

        conf.lockManagerPlugin.setString("mixed");
        conf.nontransactionalWrite.setDefault("true");
        conf.nontransactionalWrite.set(true);
        Specification spec = ((OpenJPAConfiguration) c).getSpecificationInstance();
        int specVersion = spec.getVersion();
        Compatibility compatibility = conf.getCompatibilityInstance();
        spec.setCompatibility(compatibility);
        if (specVersion < 2) {
            compatibility.setFlushBeforeDetach(true);
            compatibility.setCopyOnDetach(true);
            compatibility.setPrivatePersistentProperties(true);
            compatibility.setIgnoreDetachedStateFieldForProxySerialization(true);
            // Disable bean validation for spec level < 2 configurations
            conf.validationMode.set(String.valueOf(ValidationMode.NONE));
        } else {
            compatibility.setAbstractMappingUniDirectional(true);
            compatibility.setNonDefaultMappingAllowed(true);
        }
        return true;
    }
View Full Code Here

        Log log = emf2.getConfiguration().getLog("test");
        if (log.isTraceEnabled())
            log.trace("***** testDetach20() *****");
       
        if (log.isTraceEnabled()) {
            Compatibility compat = emf2.getConfiguration().getCompatibilityInstance();
            assertNotNull(compat);
            log.trace("FlushBeforeDetach=" + compat.getFlushBeforeDetach());
            log.trace("CopyOnDetach=" + compat.getCopyOnDetach());
            log.trace("CascadeWithDetach=" + compat.getCascadeWithDetach());
            log.trace("IgnoreDetachedStateFieldForProxySerialization=" +
                compat.getIgnoreDetachedStateFieldForProxySerialization());
        }

        OpenJPAEntityManager em = emf2.createEntityManager();
        em.clear();
       
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.