Package org.apache.openjpa.enhance

Examples of org.apache.openjpa.enhance.StateManager


        // invoke any preAttach on the detached instance
        manager.fireBeforeAttach(toAttach, meta);

        // assign the detached pc the same state manager as the object we're
        // copying into during the attach process
        StateManager smBefore = pc.pcGetStateManager();
        pc.pcReplaceStateManager(sm);
        int detach = (isNew) ? DETACH_ALL : broker.getDetachState();
        FetchConfiguration fetch = broker.getFetchConfiguration();
        try {
            FieldMetaData[] fmds = meta.getFields();
View Full Code Here


            if (emf != null) {
                if (!isManagedBy(emf, pc)) {
                    return null;
                }
            }
            StateManager sm = pc.pcGetStateManager();
           
            if (sm != null && sm instanceof OpenJPAStateManager) {
                OpenJPAStateManager osm = (OpenJPAStateManager)sm;
                return osm.getObjectId();               
            }
View Full Code Here

        }
       
        // If the object has a state manager, call it directly.
        if (obj instanceof PersistenceCapable) {
            PersistenceCapable pc = (PersistenceCapable)obj;
            StateManager sm = pc.pcGetStateManager();
            if (sm != null && sm instanceof OpenJPAStateManager) {
                return isLoaded((OpenJPAStateManager)sm, attr, null);
            }
        }       
        return LoadState.UNKNOWN;
View Full Code Here

        if (obj == null || !(obj instanceof PersistenceCapable)) {
            return null;
        }
       
        PersistenceCapable pc = (PersistenceCapable)obj;
        StateManager sm = pc.pcGetStateManager();
        if (sm == null || !(sm instanceof OpenJPAStateManager)) {
            return null;
        }
        return (OpenJPAStateManager)sm;
    }
View Full Code Here

        sm.unlock();
        return val;
    }

    public Object fetch(int field) {
        StateManager sm = _pc.pcGetStateManager();
        if (sm != null) {
            if (sm instanceof DetachedStateManager)
                return fetchFromDetachedSM((DetachedStateManager) sm, field);
            throw new UnsupportedException(_loc.get("detach-val-badsm", _pc));
        }
View Full Code Here

        sm.unlock();
        return val;
    }

    public Object fetch(int field) {
        StateManager sm = _pc.pcGetStateManager();
        if (sm != null) {
            if (sm instanceof DetachedStateManager)
                return fetchFromDetachedSM((DetachedStateManager) sm, field);
            if (_ctx.getAllowReferenceToSiblingContext() && sm instanceof StateManagerImpl) {
                return ((StateManagerImpl) sm).fetch(field);
View Full Code Here

            manager.fireBeforeAttach(toAttach, meta);
        }

        // assign the detached pc the same state manager as the object we're
        // copying into during the attach process
        StateManager smBefore = pc.pcGetStateManager();
        pc.pcReplaceStateManager(sm);
        int detach = (isNew) ? DETACH_ALL : broker.getDetachState();
        FetchConfiguration fetch = broker.getFetchConfiguration();
        try {
            FieldMetaData[] fmds = sm.getMetaData().getFields();
View Full Code Here

            Object id = util.getIdentifier(instance);
            if (id != null)
                return id.toString();
            if (instance instanceof PersistenceCapable) {
                PersistenceCapable pc = (PersistenceCapable)instance;
                StateManager sm = pc.pcGetStateManager();
                id = sm == null ? null : sm.fetchObjectId();
            }
            return id == null ? "null" : id.toString();
        }
View Full Code Here

            manager.fireBeforeAttach(toAttach, meta);
        }

        // assign the detached pc the same state manager as the object we're
        // copying into during the attach process
        StateManager smBefore = pc.pcGetStateManager();
        pc.pcReplaceStateManager(sm);
        int detach = (isNew) ? DETACH_ALL : broker.getDetachState();
        FetchConfiguration fetch = broker.getFetchConfiguration();
        try {
            FieldMetaData[] fmds = sm.getMetaData().getFields();
View Full Code Here

        }
        return false;
    }
   
    private static boolean isManagedByAnotherPCtx(PersistenceCapable pc, BrokerImpl broker) {       
        StateManager sm = pc.pcGetStateManager();
        if (sm != null && sm instanceof StateManagerImpl) {
            StateManagerImpl smi = (StateManagerImpl) sm;
            Broker associatedBroker = smi.getBroker();
           
            if (broker != associatedBroker) {
View Full Code Here

TOP

Related Classes of org.apache.openjpa.enhance.StateManager

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.