see on GitHub

Session: How to check if entity has changed?

To check if specific entity differs from the one downloaded from server hasChanged method from advanced session operations has been introduced.

Syntax

public boolean hasChanged(Object entity);

Parameters
entity Object Instance of entity for which changes will be checked.
Return Value
boolean Indicated if given entity has changed.

Example

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