You are currently browsing legacy 4.1 version of documentation. Click here to switch to the newest 5.1 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Session: How to Check if Entity has Changed

To check if a specific entity differs from the one downloaded from server, the hasChanged method from the advanced session operations can be used.


boolean hasChanged(Object entity)
entity Objec Instance of entity for which changes will be checked.
Return Value
boolean Indicated if given entity has changed.


Employee employee = session.load(Employee.class, "employees/1-A");
boolean hasChanged = session.advanced().hasChanged(employee);// false
hasChanged = session.advanced().hasChanged(employee);// true