I’m trying to use AutoBean on the server and client to send and receive json data through AppEngines channel API. I don’t want to store this data in the datastore. I already have a Proxy for this object that I use for the RequestFactoryServlet (which underneath just uses AutoBean anyways), so this should be doable. Instead of writing up a new Proxy for the object that exactly duplicates the Proxy for the RequestFactoryServlet, I’d like to just use the proxy that I use for the RequestFactoryServlet. The only problem is that I get an error while compiling that comes from my AutoBeanFactory.
Invoking generator
com.google.web.bindery.autobean.gwt.rebind.AutoBeanFactoryGenerator
[ERROR] The com.wmba.wmbaapp.shared.ObjectProxy parameterization is not simple, but the obj method does not provide a
delegate
So I’m not really sure what to do here. It seems like before I added the client side in, it’s able to serialize the object into JSON just fine, but for some reason it doesn’t like this. It sounds like it wants a delegate from me, but I can’t find anything on this from the internet.
Anyone have any ideas?
Note: I also tried the same thing with EntityProxy (which is the base of the RequestFactory framework from what I read on the AutoBean page, but I get the same error).
The issue is that
EntityProxydefines thestableIdmethod which is not a getter (name doesn’t start withget). That makes it a not simple bean, for which AutoBeans require a real bean instance to be wrapped in the createdAutoBean(the delegate, passed as an argument of the type of theAutoBean–ObjectProxyin your case– to yourobjmethod of theAutoBeanFactory).In other words, AutoBeans expects your
objmethod to be of the form:The simplest solution is to not try to reuse the entity proxy with AutoBeans.
You might be able to make it work though by annotating your
AutoBeanFactorywith:You might have to add
@NoWrap(EntityProxyId.class)too, see http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/web/bindery/requestfactory/vm/InProcessRequestFactory.java