You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 5.2 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Session: How to get entity url?

getDocumentUrl is a method in advanced() session operations that returns full url for a given entity.


public String getDocumentUrl(Object entity);
entity Object Instance of an entity for which url will be returned.
Return Value
String Full url for a given entity.


Employee employee = session.load(Employee.class, "employees/1");
// http://localhost:8080/databases/Northwind/docs/employees/1
String url = session.advanced().getDocumentUrl(employee);


If the entity is transient (not attached) this method will throw IllegalStateException.