You are currently browsing legacy 3.0 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 refresh entity?

To update entity with latest changes from server refresh method from advanced() session operations can be used.


public <T> void refresh(T entity);
entity T Instance of an entity that will be refreshed


Employee employee = session.load(Employee.class, "employees/1");
assertEquals("Doe", employee.getLastName());

// LastName changed to 'Shmoe'

assertEquals("Shmoe", employee.getLastName());


Refreshing transient entity (not attached) or entity that was deleted on server-side will result in InvalidOperationException.