I have an Entity called Parent, which has this method:
public Parent persistAndReturn() {
ObjectifyDao dao = new ObjectifyDao();
this.aBool = true;
Key<Parent> key = dao.ofy().put(this);
return dao.ofy().get(key);
}
In my App's RequestFactory interface, I have this:
@Service(Parent.class)
interface ParentRequestContext extends RequestContext {
InstanceRequest<ParentProxy, Void> persist();
InstanceRequest<ParentProxy, ParentProxy> persistAndReturn();
}
ParentRequestContext getParentRC();
Then when I want to create and persist a new Parent object, I do this...
ParentRequestContext rc = rf.getParentRC();
ParentProxy proxyObj = rc.create(ParentProxy.class);
(.. set some properties.. )
Request<ParentProxy> fetchRequest = rc.persistAndReturn().using(proxyObj);
fetchRequest.to(new Receiver<ParentProxy>(){
(... onSuccess Handler.. )
});
fetchRequest.fire();
However I get the 'autobean has been frozen' error (stack trace:
http://pastebin.com/NZ7280B9 )
Its clear from the stacktrace and other debug messages that the object
is persisted, but returning it fails.
So...
Is this possible? Is it desirable?
Also, if we look at the last line, fetchRequest.fire(), we could also
do rc.fire() instead of it, and get the same result.. Are we doing
the exact same operation when we call either 'fire' method?
Thanks,
Aidan.
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
public Parent persistAndReturn() {
ObjectifyDao dao = new ObjectifyDao();
this.aBool = true;
dao.ofy().put(this);
return this;
This was failing:
Key<NamedList> key = this.put(list);
return this.get(key);
but this works:
Key<NamedList> key = this.put(list);
return list;
I'll have to look closer at what changed between 2.2 and 2.3 that might be causing this.
/dmc
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>
>
>
> --
> David Chandler
> Developer Programs Engineer, GWT+GAE
> w: http://code.google.com/
> b: http://googlewebtoolkit.blogspot.com/
> t: @googledevtools
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsub...@googlegroups.com.
Hi David,I hate to bring up an old thread, but I noticed this happening with my switch from 2.4.0 to 2.5.0. I am using JPA/Hibernate on the backend, and my entity instance's persist() method returns "this" on the server. It stopped working with 2.5.0 with the Unfrozen bean error - BUT, it only happens when you persist an entity for the first time (not subsequent perists for update).Just wondering if you have any insight into what would cause this. I'm working around this by calling Request.find(EntityStableId) after the successful persist() call ONLY IF it was a new object being persisted (it is not necessary to do that for subsequent updates to the object).
>>> {"F":"com.plovgh.web.shared.bindery.PlovghServiceRequestFactory","I":[{"O":"gYfjUQeKypl3aT70L$lmyH$je_Q=","P":[[]]}]}
<<< {"S":[true],"I":[null]}
>>> {"F":"com.plovgh.web.shared.bindery.PlovghInstanceRequestFactory","I":[{"O":"mZy6R_9WbCm4npb8ui4de53bLjM=","P":[{"R":"1","C":5,"T":"lUUyvXo8bCZWuM6Ew6LR72oN2nQ="}],"R":["product.type","images"]}],"O":[{"O":"PERSIST","R":"1","C":5,"T":"lUUyvXo8bCZWuM6Ew6LR72oN2nQ=","P":{"product":{"R":"1","C":6,"T":"UCoe6wjm6hP1YdFtuSowpMxJ0ow="},"vendor":{"S":"IjQi","T":"NMnlePAPPa8$chg1XXK6I_qmRTc="},"defaultQuantity":100,"defaultUnit":"lb.","name":"foo","defaultPrice":"10","images":[]}},{"O":"PERSIST","R":"1","C":6,"T":"UCoe6wjm6hP1YdFtuSowpMxJ0ow=","P":{"type":{"S":"IjEi","T":"vCoN_GmihaJOTBwUCW2N_JPjlaY="},"name":"foo"}},{"O":"UPDATE","S":"IjEi","T":"vCoN_GmihaJOTBwUCW2N_JPjlaY=","V":"MC4w"}]}
<<< {"S":[true],"O":[{"T":"lUUyvXo8bCZWuM6Ew6LR72oN2nQ=","V":"MC4w","P":{"product":{"T":"UCoe6wjm6hP1YdFtuSowpMxJ0ow=","S":"Ijk0Ig=="},"id":"94","defaultQuantity":100,"name":"foo","images":[],"defaultUnit":"lb.","active":true,"defaultPrice":"10"},"S":"Ijk0Ig==","C":5,"O":"PERSIST"},{"T":"NMnlePAPPa8$chg1XXK6I_qmRTc=","V":"Ni4w","S":"IjQi","O":"UPDATE"},{"T":"UCoe6wjm6hP1YdFtuSowpMxJ0ow=","V":"MC4w","P":{"name":"foo","type":{"T":"vCoN_GmihaJOTBwUCW2N_JPjlaY=","S":"IjEi"}},"S":"Ijk0Ig==","C":6,"O":"PERSIST"},{"T":"vCoN_GmihaJOTBwUCW2N_JPjlaY=","V":"MC4w","P":{"name":"Other"},"S":"IjEi","O":"UPDATE"}],"I":[{"T":"lUUyvXo8bCZWuM6Ew6LR72oN2nQ=","S":"Ijk0Ig=="}]}
Here's another persist request with a subsequent refresh:
>>> {"F":"com.plovgh.web.shared.bindery.PlovghServiceRequestFactory","I":[{"O":"gYfjUQeKypl3aT70L$lmyH$je_Q=","P":[[]]}]}
<<< {"S":[true],"I":[null]}
>>> {"F":"com.plovgh.web.shared.bindery.PlovghInstanceRequestFactory","I":[{"O":"mZy6R_9WbCm4npb8ui4de53bLjM=","P":[{"R":"1","C":1,"T":"lUUyvXo8bCZWuM6Ew6LR72oN2nQ="}],"R":["product.type","images"]}],"O":[{"O":"PERSIST","R":"1","C":1,"T":"lUUyvXo8bCZWuM6Ew6LR72oN2nQ=","P":{"product":{"R":"1","C":2,"T":"UCoe6wjm6hP1YdFtuSowpMxJ0ow="},"vendor":{"S":"IjQi","T":"NMnlePAPPa8$chg1XXK6I_qmRTc="},"defaultQuantity":100,"defaultUnit":"lbs.","name":"foo","defaultPrice":"10","images":[]}},{"O":"PERSIST","R":"1","C":2,"T":"UCoe6wjm6hP1YdFtuSowpMxJ0ow=","P":{"type":{"S":"IjEi","T":"vCoN_GmihaJOTBwUCW2N_JPjlaY="},"name":"foo"}},{"O":"UPDATE","S":"IjEi","T":"vCoN_GmihaJOTBwUCW2N_JPjlaY=","V":"MC4w"}]}
<<< {"S":[true],"O":[{"T":"lUUyvXo8bCZWuM6Ew6LR72oN2nQ=","V":"MC4w","P":{"product":{"T":"UCoe6wjm6hP1YdFtuSowpMxJ0ow=","S":"Ijk3Ig=="},"id":"97","defaultQuantity":100,"name":"foo","images":[],"defaultUnit":"lbs.","active":true,"defaultPrice":"10"},"S":"Ijk3Ig==","C":1,"O":"PERSIST"},{"T":"UCoe6wjm6hP1YdFtuSowpMxJ0ow=","V":"MC4w","P":{"name":"foo","type":{"T":"vCoN_GmihaJOTBwUCW2N_JPjlaY=","S":"IjEi"}},"S":"Ijk3Ig==","C":2,"O":"PERSIST"},{"T":"NMnlePAPPa8$chg1XXK6I_qmRTc=","V":"Ni4w","S":"IjQi","O":"UPDATE"},{"T":"vCoN_GmihaJOTBwUCW2N_JPjlaY=","V":"MC4w","P":{"name":"Other"},"S":"IjEi","O":"UPDATE"}],"I":[{"T":"lUUyvXo8bCZWuM6Ew6LR72oN2nQ=","S":"Ijk3Ig=="}]}
>>> {"F":"com.plovgh.web.shared.bindery.PlovghInstanceRequestFactory","I":[{"O":"?","P":[{"S":"Ijk3Ig==","T":"lUUyvXo8bCZWuM6Ew6LR72oN2nQ="}],"R":["product.type","images"]}]}
<<< {"S":[true],"O":[{"T":"lUUyvXo8bCZWuM6Ew6LR72oN2nQ=","V":"MC4w","P":{"product":{"T":"UCoe6wjm6hP1YdFtuSowpMxJ0ow=","S":"Ijk3Ig=="},"id":"97","defaultQuantity":100,"name":"foo","images":[],"defaultUnit":"lbs.","active":true,"defaultPrice":"10.00"},"S":"Ijk3Ig==","O":"UPDATE"},{"T":"UCoe6wjm6hP1YdFtuSowpMxJ0ow=","V":"MC4w","P":{"name":"foo","type":{"T":"vCoN_GmihaJOTBwUCW2N_JPjlaY=","S":"IjEi"}},"S":"Ijk3Ig==","O":"UPDATE"},{"T":"vCoN_GmihaJOTBwUCW2N_JPjlaY=","V":"MC4w","P":{"name":"Other"},"S":"IjEi","O":"UPDATE"}],"I":[{"T":"lUUyvXo8bCZWuM6Ew6LR72oN2nQ=","S":"Ijk3Ig=="}]}