My GWT+GAE app uses Requestfactroy entity locator and at the server side i use Objectify, it works well when my Entity ID type is String, now i want to change to Long id, and stuck: by using the locator signature i can not find the entity:
@Override
public T find( Class<? extends T> clazz, Long id )
{
}
Because Objectify requires @Parent key included to fetch the sub-entities(HRD), and from the method above we can not get the parent. I found this thread from GWT forum: here
However this thread seems didn't give any constructive suggestions(it falls back to String ID Entity finally for the solution).
Many thanks.
The problem is that the long ID is not enough to identify your object. As you say, you also need its parent, so the ID is actually a compound ID: the parent object, and the child's ID.
BTW, what's the problem with using the keyToString
or similar here? (as suggested on the thread you link to)
The ID from a Locator
is only used on the server-side and only by the locator (and serialized as-is to be passed back and forth to/from the client; but they're opaque things on the client-side, that you aren't even given access).