On Thu, Sep 23, 2021 at 07:55 AM, Andy wrote:
NucleusJDOHelper(DataNucleusHelperJDO in v6).getDirtyFields returns based on any specific fields being marked dirty due to being updated. Your fields have not been updated (since meeting the persistence process and having a StateManager assigned).
Thanks; that is what I suspected, but wasn't sure. I am using the ObjectProvider to get the LifecycleState and use the boolean helpers (ie: isNew(), isDeleted(), isDirty(), etc); I suspect that is similar (other than the LifecycleState being a DN construct and not a JDO standard)?
I would have expected that for a P_NEW object, all non-null fields would be identified as Dirty (even though they were modified prior to having the StateManager assigned). From my perspective, a `dirty` field/object is a value which is not representative of the corresponding value in the DataStore. Given that the object is P_NEW, by definition, none of the fields have been persisted, and consequently I would expect them to all be "dirty".
I am not sure how other ORMs handle field states of NEW objects. Is this concept of NEW objects not having dirty fields unique to DN or is there a particular design reason/decision that this was approached like this?
Thanks,
Eric