Session: How to get entity url?
getDocumentUrl
is a method in advanced()
session operations that returns full url for a given entity.
Syntax
public String getDocumentUrl(Object entity);
Parameters | ||
---|---|---|
entity | Object | Instance of an entity for which url will be returned. |
Return Value | |
---|---|
String | Full url for a given entity . |
Example
Employee employee = session.load(Employee.class, "employees/1");
// http://localhost:8080/databases/Northwind/docs/employees/1
String url = session.advanced().getDocumentUrl(employee);
Remarks
If the entity is transient (not attached) this method will throw IllegalStateException
.