java.lang.IllegalArgumentException: Attempting to edit an EntityProxy previously edited by another RequestContext in gwt

1,195 views
Skip to first unread message

lucky

unread,
May 4, 2012, 3:23:32 AM5/4/12
to Google Web Toolkit
I´m using GWT RequestFactory and want to transport client-side
parameters in a service.
The parameters should be created on the client, because they aren´t
part of the domain model and won´t be stored in the database.


so i have created one valueProxy with getters and setters with
paramater values

@ProxyFor(value = aaa.class)
public interface aaaProxy extends ValueProxy{

void setState(String state);

String getState();
}

public class aaa{


private String state;

public String getState() {
return state;
}

public void setState(String state) {
this.state = state;
}

}

Also specified in the RequestFactory interface in the following way:

@Service(value = aaaServiceImpl.class)
public interface aaaRequest extends RequestContext {
Request<List<StateProxy>> getStates() throws Exception;

Request<Void> search(aaaProxy result) throws Exception;
}
aaaRequest aaaRequestContext();

These two methods are implemtnted in aaaServiceImpl class


now when i tried to instantiate the object in widget.java i.e., in
client side:

aaaRequest req =
clientFactory.getRequestFactory().aaaRequestContext();
aaaProxy searchproxy = req.create(aaaProxy.class);
searchproxy.setState(StateBox.getItemText(0));

I am getting the following exception:

java.lang.IllegalArgumentException: Attempting to edit an EntityProxy
previously edited by another RequestContext in gwt

i see in the DynaTableRf example.
but i am not able to understand the persist method.

Please help me did i miss anything here?

kjordan

unread,
May 4, 2012, 10:21:04 AM5/4/12
to google-we...@googlegroups.com
What line is actually causing the exception?  Are you trying to pass the created aaaProxy into the persist method of another RequestContext? If so, just list aaaProxy in @ExtraTypes in your other RequestContext and create it through that.  Another option is to use append on the RequestContexts ( http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/web/bindery/requestfactory/shared/RequestContext.html#append(T) ).  Or are you passing it to the search method listed above?  If so, use the same aaaRequest: req.search(searchproxy).fire(new Receiver<Void>() {}).  Although it seems like your search method should be returning something if it is indeed searching on the data inside that proxy because since ValueProxys aren't persisted that would end up doing nothing for your client-side.

lucky

unread,
May 14, 2012, 2:41:02 AM5/14/12
to google-we...@googlegroups.com

In the widget.java before the below lines i called

aaaRequest  req1 =  clientFactory.getRequestFactory().aaaRequestContext();
            req1.getStates().fire(new Receiver<List<StateProxy>>(){

  onsucess(){
  .........................
}
after that i call
}

req.search(setSearchCriteraFromDisplay()).fire(new Receiver<Void>()(While calling this fire () method i am getting the exception) {

}
in setSearchCriteraFromDisplay
   aaaProxy searchproxy = req.create(aaaProxy.class);
                searchproxy.
setState(StateBox.getItemText(0));





On Friday, 4 May 2012 12:53:32 UTC+5:30, lucky wrote:
I´m using GWT RequestFactory and want to transport client-side
parameters in a service.
The parameters should be created on the client, because they aren´t
part of the domain model and won´t be stored in the database.


so i have created one valueProxy with getters and setters with
paramater values

@ProxyFor(value = aaa.class)
public interface aaaProxy extends ValueProxy{

        void setState(String state);

        String getState();
}

public class aaa{


private String state;

public String getState() {
        return state;
}

public void setState(String state) {
        this.state = state;
}

}

Also specified in the RequestFactory interface in the following way:

@Service(value = aaaServiceImpl.class)
public interface aaaRequest extends RequestContext {
        Request<List<StateProxy>> getStates() throws Exception;

        Request<Void> search(aaaProxy result) throws Exception;
}
aaaRequest aaaRequestContext();

These two methods are implemetnted in aaaServiceImpl class

lucky

unread,
May 14, 2012, 6:03:12 AM5/14/12
to Google Web Toolkit
I am getting exception when i call the fire method.

req.search(setPropertySearchCriteraFromDisplay()).fire(new
Receiver<Void>() {
@Override
public void onSuccess(Void user) {
System.out.println("on success");

}

@Override
public void onFailure(ServerFailure error) {
System.out.println("on Failure");
}

});




On May 4, 7:21 pm, kjordan <ke...@kjordan.net> wrote:
> What line is actually causing the exception?  Are you trying to pass the
> created aaaProxy into the persist method of another RequestContext? If so,
> just list aaaProxy in @ExtraTypes in your other RequestContext and create
> it through that.  Another option is to use append on the RequestContexts (http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/googl...) ).
Reply all
Reply to author
Forward
0 new messages