Session: How to Check if There are Any Changes on a Session
Single entity can be checked for changes using hasChanged() method, but there is also a possibility to check if there are any changes on a session or even what has changed. Both the hasChanges() method and the whatChanged() method are available in the advanced session operations.
Property indicates if the session contains any changes. If there are any new, changed or deleted entities.