I have an EntityProxy in my system that has some read-only properties. I have getter methods for these defined in the proxy, but no setters. I can retrieve the object from the server fine, but when I go to save it, I see:
Jan 26, 2011 4:40:34 PM com.google.gwt.requestfactory.server.ServiceLayerDecorator die
SEVERE: Could not locate setter for property uniqueIndex in type com.mycompany.mydevice.MyObject
java.lang.NoSuchMethodException: com.mycompany.mydevice.MyObject.setUniqueIndex(java.lang.String)
at java.lang.Class.getMethod(Class.java:1605)
at com.google.gwt.requestfactory.server.ReflectiveServiceLayer.setProperty(ReflectiveServiceLayer.java:216)
at com.google.gwt.requestfactory.server.ServiceLayerDecorator.setProperty(ServiceLayerDecorator.java:161)
at com.google.gwt.requestfactory.server.ServiceLayerDecorator.setProperty(ServiceLayerDecorator.java:161)
at com.google.gwt.requestfactory.server.SimpleRequestProcessor$1.visitValueProperty(SimpleRequestProcessor.java:505)
at com.google.gwt.autobean.server.ProxyAutoBean.traverseProperties(ProxyAutoBean.java:240)
at com.google.gwt.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:153)
at com.google.gwt.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:112)
at com.google.gwt.requestfactory.server.SimpleRequestProcessor.processOperationMessages(SimpleRequestProcessor.java:479)
at com.google.gwt.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:202)
at com.google.gwt.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:125)
at com.google.gwt.requestfactory.server.RequestFactoryServlet.doPost(RequestFactoryServlet.java:118)
...
My POJO object on the server side has a getUniqueIndex() method which is exposed on the EntityProxy, but nowhere in my code refers to a setUniqueIndex method.
The current flow is:
From client side, call a method from the RequestFactory to instantiate a new object on the server and return it to the client. (this object is not yet persisted, so getId and getVersion return null)
Edit the object with an editor, and then make another server call to persist it. The second server call is where I see the exception.
Interestingly, if I follow this same flow with an already existing object (one where getId and getVersion return real values), it works fine. Is there some scenario that causes the AutoBean to try to reconstruct the POJO class from a list of properties instead of just proxying the set() requests? Do I need to do anything special on the client side to make sure the server side doesn't disconnect from the newly created but not yet persisted class, for example re-use the Request object or something like that?
My server side code is simply:
public MyObject createAndInit()
{
return new MyObject ();
}
and the second server call simply performs a persist.
Thanks,
Eric