Thursday, April 25, 2013

Re: Entity not persisted, using JDO,RequestFactory.

I am still not able to persist poll entity using Requestfactory in GWT. Please point out if there's anything wrong with following code.

view.setMsg("preparing");
PollRequest pr = requestFactory.pollRequest();
UserRequest ur = requestFactory.userRequest();
final UserProxy[] oldUser=new UserProxy[1];
ur.findUser(Cookies.getCookie("user")).fire(new Receiver<UserProxy>(){
@Override
public void onSuccess(UserProxy user){
oldUser[0]=user;
}
});

UserProxy editUser=ur.edit(oldUser[0]);
PollProxy createdPoll = ur.create(PollProxy.class);
createdPoll.setQuestion(view.getQuestion());
createdPoll.setOptions(view.asEditor().getList());
createdPoll.setCloseTime(closeTime);
createdPoll.setUser(oldUser[0]);
editUser.setPolls(createdPoll);
ur.persist().using(editUser).fire(new Receiver<Void>(){
@Override
public void onSuccess(Void arg0){
view.setMsg("POll Created");
}
});

--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment