The following solved my problem:
Actually edit(object) returns a new "mutable version" of the entityProxy, that can be worked with. Changing values and persisting did not cause exceptions anymore.
Am Montag, 24. August 2015 21:10:30 UTC+2 schrieb Manuel:
-- request = AppManager.getRequestFactory().personRequest();
object = request.edit(object); //object is the Proxy passed to me
// request.edit(object); // instead of this...
Actually edit(object) returns a new "mutable version" of the entityProxy, that can be worked with. Changing values and persisting did not cause exceptions anymore.
Am Montag, 24. August 2015 21:10:30 UTC+2 schrieb Manuel:
Hi everyone,
Im using the requestFactory and want to update an entity. The problem is, its frozen.
I get an entityProxy passed, were I like to update 1 value. The problem is, when I try to edit it with a new Request, it fails, cause the proxy is frozen.
I found this: http://stackoverflow.com/questions/7479779/gwt- autobean-frozen-when-saving- graph
It says, I got to get a new entityProxy from the server.
This would take 1 request to receive a "fresh" entityProxy and another for the update... I was wondering, if there is a better way to do this? Or whats the proper way to update a entity with just 1 request?
Is there a way to actually create a new entityProxy on the client that updates an existing entity without loading it from the server?
Thats what I tried:
PersonRequest request = AppManager.getRequestFactory(). personRequest();
PersonProxy proxy = request.create(PersonProxy.class );
proxy.setSalary(0);
proxy.setId(object.getId()); // Copy values of passed object
proxy.setVersion(object.getVersion ());
request.persist(proxy).fire(new Receiver<PersonProxy>()
Copy all values ends in hibernate Exception for detached entity passed to persist.
Thanks in advance.
Regards
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment