The JavaDoc for EntityProxy.stableId() says:
"An id returned by a proxy newly created by RequestContext.create
Object.equals(Object) those returned later by proxies to the persisted object."
Does that mean that the stable id will be valid for that object across different request contexts? across different request factory instances? I suppose I’m asking what is the scope of the stable id?
The
EntityProxyIdobject has a global scope and is suitable for long-term use as aMapkey or member of aSet.EntityProxyIdobjects can be used across different instances and types of aRequestFactory(assuming that the proxy type is reachable from theRequestFactoryin question). TheRequestFactory.getHistoryToken()andgetProxyIdmethods can create a string representation of anEntityProxyIdthat is suitable for client-side persistence.The one exception to the global scope of an
EntityProxyIdis the id of a newly-createdEntityProxythat has not yet been persisted on the server. An “ephemeral” id is only usable with theRequestFactoryfrom which the newly-created proxy object is derived. Once the proxy has been sent to the server and the server has provided a non-null id, the ephemeral id is upgraded to a persistent id and becomes indistinguishable from any other persistent id. The object identity of the upgradedEntityProxyIddoes not change, so ephemeral ids can be added toMaporSetand be retrieved later.