/** * Method to save all fields of the object. **/ public void saveFields() { savedImage = myPC.jdoNewInstance(this); savedImage.jdoCopyFields(myPC, allFieldNumbers); savedFlags = jdoFlags; savedLoadedFields = (boolean[])loadedFields.clone(); }
/** Create a new instance of the class and assign its * <code>jdoStateManager</code>. The new instance has its * <code>jdoFlags</code> set to <code>LOAD_REQUIRED</code>. * @see PersistenceCapable#jdoNewInstance(StateManager sm) * @param pcClass the <code>PersistenceCapable</code> class. * @param sm the <code>StateManager</code> which will own the new instance. * @return the new instance, or <code>null</code> if the class is not * registered. */ public PersistenceCapable newInstance (Class pcClass, StateManager sm) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return pcInstance == null?null:pcInstance.jdoNewInstance(sm); }
/** Create a new instance of the class and assign its * <code>jdoStateManager</code>. The new instance has its * <code>jdoFlags</code> set to <code>LOAD_REQUIRED</code>. * @see PersistenceCapable#jdoNewInstance(StateManager sm) * @param pcClass the <code>PersistenceCapable</code> class. * @param sm the <code>StateManager</code> which will own the new instance. * @return the new instance, or <code>null</code> if the class is not * registered. */ public PersistenceCapable newInstance (Class pcClass, StateManager sm) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return pcInstance == null?null:pcInstance.jdoNewInstance(sm); }
/** Create a new instance of the class and assign its * <code>jdoStateManager</code> and key values from the ObjectId. If the * oid parameter is <code>null</code>, no key values are copied. * The new instance has its <code>jdoFlags</code> set to * <code>LOAD_REQUIRED</code>. * @see PersistenceCapable#jdoNewInstance(StateManager sm, Object oid) * @param pcClass the <code>PersistenceCapable</code> class. * @param sm the <code>StateManager</code> which will own the new instance. * @return the new instance, or <code>null</code> if the class is not * registered. * @param oid the ObjectId instance from which to copy key field values. */ public PersistenceCapable newInstance (Class pcClass, StateManager sm, Object oid) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return pcInstance == null?null:pcInstance.jdoNewInstance(sm, oid); }
/** Create a new instance of the class and assign its * <code>jdoStateManager</code> and key values from the ObjectId. If the * oid parameter is <code>null</code>, no key values are copied. * The new instance has its <code>jdoFlags</code> set to * <code>LOAD_REQUIRED</code>. * @see PersistenceCapable#jdoNewInstance(StateManager sm, Object oid) * @param pcClass the <code>PersistenceCapable</code> class. * @param sm the <code>StateManager</code> which will own the new instance. * @return the new instance, or <code>null</code> if the class is not * registered. * @param oid the ObjectId instance from which to copy key field values. */ public PersistenceCapable newInstance (Class pcClass, StateManager sm, Object oid) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return pcInstance == null?null:pcInstance.jdoNewInstance(sm, oid); }
PersistenceCapable pcCopy = myPC.jdoNewInstance(this, myPC.jdoGetObjectId());
PersistenceCapable pcCopy = myPC.jdoNewInstance(this); pcCopy.jdoCopyFields(myPC, allFieldNumbers);
PersistenceCapable detachedPC = myPC.jdoNewInstance(this); detachingPC = detachedPC;