Package org.apache.openjpa.enhance

Examples of org.apache.openjpa.enhance.PersistenceCapable.pcGetStateManager()


        boolean assertThisContext) {
        if (ImplHelper.isManageable(obj)) {
            PersistenceCapable pc = ImplHelper.toPersistenceCapable(obj, _conf);
            BrokerImpl pcBroker = (BrokerImpl)pc.pcGetGenericContext();
            if (pcBroker == this || isFromWriteBehindCallback())
                return (StateManagerImpl) pc.pcGetStateManager();
            if (assertThisContext && pcBroker != null)
                throw new UserException(_loc.get("not-managed",
                    Exceptions.toString(obj))).setFailedObject(obj);
        }
        return null;
View Full Code Here


            return 0;

        PersistenceCapable pc1 = ImplHelper.toPersistenceCapable(o1, _conf);
        PersistenceCapable pc2 = ImplHelper.toPersistenceCapable(o2, _conf);
        OpenJPAStateManager sm1 = (OpenJPAStateManager) pc1.pcGetStateManager();
        OpenJPAStateManager sm2 = (OpenJPAStateManager) pc2.pcGetStateManager();
        if (sm1 == null || sm2 == null)
            return 0;

        Object v1 = sm1.fetchField(_rel.getIndex(), false);
        Object v2 = sm2.fetchField(_rel.getIndex(), false);
View Full Code Here

        // order on primary key values
        PersistenceCapable pc1 = ImplHelper.toPersistenceCapable(o1, _conf);
        PersistenceCapable pc2 = ImplHelper.toPersistenceCapable(o2, _conf);
        OpenJPAStateManager sm1 = (OpenJPAStateManager) pc1.pcGetStateManager();
        OpenJPAStateManager sm2 = (OpenJPAStateManager) pc2.pcGetStateManager();
        if (sm1 == null || sm2 == null)
            return 0;

        Object[] pk1 = toPKValues(sm1);
        Object[] pk2 = toPKValues(sm2);
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

    private void assertDetachedSM(Object obj) {
        OpenJPAEntityManager pm = getPM();
        assertTrue(pm.isDetached(obj));
        PersistenceCapable pc = (PersistenceCapable) obj;
        assertEquals(DetachedStateManager.class,
            pc.pcGetStateManager().getClass());
        endEm(pm);
    }
}
View Full Code Here

        // instance before asking our context
        OpenJPAStateManager sm;
        if (ImplHelper.isManageable(obj)) {
          PersistenceCapable pc = ImplHelper.toPersistenceCapable(obj,
                    getRepository().getConfiguration());
            sm = (OpenJPAStateManager) pc.pcGetStateManager();
            if (sm == null) {
              ret = getValueFromUnmanagedInstance(obj, cols, true);
            } else if (sm.isDetached()) {
              obj = store.getContext().find(sm.getObjectId(), false, null);
              sm = store.getContext().getStateManager(obj);
View Full Code Here

                        PersistenceCapable pc = (PersistenceCapable) itr.next();

                        if (pc == null)
                            continue;

                        OpenJPAStateManager sm = (OpenJPAStateManager) pc.
                            pcGetStateManager();
                        FieldMapping[] fmd = ((ClassMapping) sm.getMetaData()).
                            getFieldMappings();
                        for (int j = 0; j < fmd.length; j++) {
                            Object oid = sm.getIntermediate(fmd[j].getIndex());
View Full Code Here

        // from other persistence contexts, so try to get sm directly from
        // instance before asking our context
        if (ImplHelper.isManageable(val)) {
            PersistenceCapable pc = ImplHelper.toPersistenceCapable(val,
                store.getConfiguration());
            if (pc.pcGetStateManager() != null)
                return pc.pcGetStateManager();
        }
        return RelationStrategies.getStateManager(val, store.getContext());
    }
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.