Package javax.jdo.spi

Examples of javax.jdo.spi.PersistenceCapable.jdoReplaceStateManager()


                }

                // Create a SM for our copy object
                JDOStateManagerImpl smDetachedPC = new JDOStateManagerImpl(myOM, cmd);
                smDetachedPC.initialiseForDetached(detachedPC, getExternalObjectId(myPC), getVersion(myPC));
                detachedPC.jdoReplaceStateManager(smDetachedPC);
                smDetachedPC.referencedPC = myPC;

                smDetachedPC.replaceFields(getFieldsNumbersToDetach(), new DetachFieldManager(this, getSecondClassMutableFields(),
                    myFP, state, true));
View Full Code Here


                {
                    smDetachedPC.makeTransient(null);
                }

                // Remove its StateManager since now detached or transient
                detachedPC.jdoReplaceStateManager(null);
            }
            catch (Exception e)
            {
                // What could possible be thrown here ?
                JPOXLogger.PERSISTENCE.debug("DETACH ERROR : Error thrown while detaching " +
View Full Code Here

            }

            // Add a state manager to the detached PC so that we can retrieve its detached state
            JDOStateManagerImpl smDetachedPC = new JDOStateManagerImpl(myOM, cmd);
            smDetachedPC.initialiseForDetached(detachedPC, getExternalObjectId(detachedPC), null);
            detachedPC.jdoReplaceStateManager(smDetachedPC);

            // Cross-reference the attached and detached objects for the attach process
            smDetachedPC.referencedPC = myPC;
            this.referencedPC = detachedPC;
View Full Code Here

            // Go through all related fields and attach them (including relationships)
            internalAttachCopy(this, smDetachedPC, smDetachedPC.loadedFields, smDetachedPC.dirtyFields, persistent,
                smDetachedPC.myVersion, true);

            // Remove the state manager from the detached PC
            detachedPC.jdoReplaceStateManager(null);

            // Remove the corss-referencing now we have finished the attach process
            smDetachedPC.referencedPC = null;
            this.referencedPC = null;
View Full Code Here

        // Create a StateManager to give us a means of extracting the detached info
        PersistenceCapable pc = (PersistenceCapable)obj;
        org.jpox.ObjectManager thePM = ((AbstractPersistenceManager)pm).getObjectManager();
        StateManager sm = StateManagerFactory.newStateManagerForDetached(thePM, pc, getObjectId(pc), null);
        pc.jdoReplaceStateManager((javax.jdo.spi.StateManager) sm); // Assign this StateManager to our detached object
        sm.retrieveDetachState(sm);
        String[] dirtyFieldNames = sm.getDirtyFieldNames();
        pc.jdoReplaceStateManager(null); // Remove the StateManager from our detached object

        return dirtyFieldNames;
View Full Code Here

        org.jpox.ObjectManager thePM = ((AbstractPersistenceManager)pm).getObjectManager();
        StateManager sm = StateManagerFactory.newStateManagerForDetached(thePM, pc, getObjectId(pc), null);
        pc.jdoReplaceStateManager((javax.jdo.spi.StateManager) sm); // Assign this StateManager to our detached object
        sm.retrieveDetachState(sm);
        String[] dirtyFieldNames = sm.getDirtyFieldNames();
        pc.jdoReplaceStateManager(null); // Remove the StateManager from our detached object

        return dirtyFieldNames;
    }

    /**
 
View Full Code Here

        // Create a StateManager to give us a means of extracting the detached info
        PersistenceCapable pc = (PersistenceCapable)obj;
        org.jpox.ObjectManager thePM = ((AbstractPersistenceManager)pm).getObjectManager();
        StateManager sm = StateManagerFactory.newStateManagerForDetached(thePM, pc, getObjectId(pc), null);
        pc.jdoReplaceStateManager((javax.jdo.spi.StateManager) sm); // Assign this StateManager to our detached object
        sm.retrieveDetachState(sm);
        String[] loadedFieldNames = sm.getLoadedFieldNames();
        pc.jdoReplaceStateManager(null); // Remove the StateManager from our detached object

        return loadedFieldNames;
View Full Code Here

            // Create a new PC with the same field values
            PersistenceCapable pcCopy = myPC.jdoNewInstance(this);
            pcCopy.jdoCopyFields(myPC, getAllFieldNumbers());

            // Swap the managed PC to be the copy and not the input
            pcCopy.jdoReplaceStateManager(this);
            myPC = pcCopy;
            disconnectClone((PersistenceCapable)pc);
        }

        // Mark all fields as loaded since we are using the passed PersistenceCapable
View Full Code Here

            pcCopy.jdoCopyFields(myPC, cacheableFieldNumbers);
        }

        // Reset jdoFlags in the copy to PersistenceCapable.READ_WRITE_OK and clear its state manager.
        pcCopy.jdoReplaceFlags();
        pcCopy.jdoReplaceStateManager(null);
        return new CachedPC(pcCopy, l2loadedFields, transactionalVersion);
    }

    /**
     * Method that replaces the PC managed by this StateManager to be the supplied object.
View Full Code Here

        {
            ExecutionContext ec = ((JDOPersistenceManager)pm).getObjectManager();

            // Temporarily attach a StateManager to access the detached field information
            StateManager sm = (StateManager) ObjectProviderFactory.newForDetached(ec, pc, getObjectId(pc), null);
            pc.jdoReplaceStateManager((javax.jdo.spi.StateManager) sm);
            sm.retrieveDetachState(sm);
            String[] dirtyFieldNames = sm.getDirtyFieldNames();
            pc.jdoReplaceStateManager(null);

            return dirtyFieldNames;
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.