Conflicting results from calls to NucleusJDOHelper.isDirty()


I'm trying to identify which fields of a Persistable object are dirty, but running into what seems to be conflicting information from the NucleusJDOHelper functions.  I don't know if this is expected behaviour, or a bug.

When creating a new Persistable object, in an event listener, I can retrieve the persistable object and check:


Student p = new Student("First Student");
p.setAddress(new Address(new Street[]{new Street("Regina")}));



public void
postStore(InstanceLifecycleEvent event) {
Persistable pc = (Persistable)event.getSource(); PersistenceManager pm = (PersistenceManager)pc.dnGetExecutionContext().getOwner();"Audit : postStore for " + ((Persistable) event.getSource()).dnGetObjectId());"Audit: Object Dirty : " + NucleusJDOHelper.isDirty(pc));"Audit: Dirty Fields : " + NucleusJDOHelper.getDirtyFields(pc, pm)); }

I get the following output:

16:23:04,262 (main) INFO  [DataNucleus.General] - Audit : postStore for mydomain.model.Student-1
16:23:04,262 (main) INFO [DataNucleus.General] - Audit: Object Dirty : true
16:23:04,262 (main) INFO [DataNucleus.General] - Audit: Dirty Fields : null

Is that expected behaviour?  That the list of dirty fields is empty if it is a new object, but the object is considered dirty?
If so, is there any way to get a list of the fields that have been set in the new object?



Join to automatically receive all group messages.