EntityProxyChange.registerForProxyType(...) can be used to get the ID of the persisted object.
The receiver's EntityProxyChange.Handler<PersonProxy>.onProxyChange(EntityProxyChange<PersonProxy> event) will be called. event.getWriteOperation() should return PERSIST event.getProxyId() should return the stable id of the proxy. This should help with a restful navigation after a successful persist. On Dec 14, 9:14 pm, RyanD <[email protected]> wrote: > This might be better logged as a feature request, but I wanted to > check that I hadn't missed something first. > > Given something like this: > > PersonProxy person = context.create(PersonProxy.class); > person.setName(name); > context.persist().using(person).fire(..... etc. > > In the call to: > > onSuccess > > person.getId() == null > > Even though of course the persistence layer assigned it an ID. > > Seems like it would be pretty useful to have GWT RF not necessarily > transmit every person property back to the client after a successful > persist, but certainly getting the ID back to the client would be > useful. For example, after the successful persist, let's say I want > to restfully navigate to a PersonPlace and use the person's new ID > (assigned by persistence layer) in the token? > > As it is for that case, which will be pretty common in a rest style > CRUD app, I'd have to create a static method like: > > createPerson(String name) > > then return a PersonProxy. But that seems to defeat the purpose of > having context.persist() around for more complex objects where you > don't necessarily want to create a giant factory method. > > Anything I missed, or should getting the persisted ID back to the > client be a feature request? > > Thanks. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
