I am using the PostFlush in the DefaultFlushEventListener to try and get any saved entities so that I can raise some domain events to say that the relevant entities have changed, now I want to do this in the batch and am using something like this atm:
var entityEntries = session.PersistenceContext.EntityEntries;
var entitiesByType = entityEntries.Keys
.Cast<EntityBase>()
.Where(x => ((EntityEntry)entityEntries[x]).LockMode == LockMode.Write)
.GroupBy(x => x.GetType(), x => x);
This groups changes by type for me and using the LockMode check it seems to give me only changed entities. I had hoped I could use Status == Status.Saving but this did not seem to work, is my check going to be ok or is there a better way to check if the entry is dirty.
Thanks
Stefan