I am trying to send an object similar to the UserModel object in the Dozer tutorial back to my client through GWT-RPC.
However, I am getting a warning that points out that the Model contained within UserModel (namely, the AddressModel) cannot properly be serialized. The Rich Jerk.::
The Rich Jerk Now Pays Up To 400% Commission On His $10 Ebook. 75% Paid Through CB, And The Remainder Paid Via PayPal(R). Payout Determined By Volume. 100-199 Sales/month = $20/sale. 200-299 Sales/month = $30/sale. 300+ Sales/month = $40/sale.
http://welcomewlc.RICHJERK.hop.clickbank.netHOME |
Is there something about which I need to be aware for any child Model objects to be serialized properly?
[WARN] StandardContextException while dispatching incoming RPC call
Caused by: com.google.gwt.user.client.rpc.SerializationExcept ion: Type 'com.softroots.sonic.client.model.AddressModel' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.
Thank you for the response. Unfortunately, none of the suggestions worked, nor a combination of the suggestions worked.
Darrell, in your tests, can you try sending an object graph of Models through the GWT-RPC??
Yes. They do have zero-argument constructors.
Have you any idea why subclassing from BaseModel or BaseModelData does not allow nested Models to be properly serialized? Would it be futile to try and rewrite my own BaseModel for serialization? Is this a bug in the models?
Yes, adding the dummy field of the type that was causing the serialization problem worked.
Grandiosa and Darrell, thank you both for your assistance. Hopefully this helps others as well!
Do your model objects have zero arg constructors?
Take a look at this blog post for new Java Bean support. With this approach, you can send any bean (not GXT models) objects via RPC and use then with a Store. 1% M.o.l.b. Wealth Formula.::
New Revolutionary Product And Sales Page Concept. Video Proof On Sales Page Of $541,839 In Net Profit Drives Conversion Through The Ruff! Get Affiliate Tools Here: Http://www.molb-wealth-formula.net/affiliateresources.html.
http://welcomewlc.MOLB1.hop.clickbank.netHOME |
1) I assume that since this works with stores, I will be able to use this solution for anything that uses a store (tables, lists...) and not just the Grid you provided as an example?
Yes.
2) Does this handle nested-objects correctly as the simple work-around for the BaseModel does?
Not at this time. However, I hope to add this feature soon.
Two questions before I plunge into this, as this looks like a terrific solution.
1) I assume that since this works with stores, I will be able to use this solution for anything that uses a store (tables, lists...) and not just the Grid you provided as an example?
2) Does this handle nested-objects correctly as the simple work-around for the BaseModel does?
I am looking forward to using this!
GWT does not "see" the types stored in the internal map. Add a dummy field to your subclass with a type of AddressModel. If you still have problems then post your code for UserModel. Both AddressModel and UserModel should implement Serialazable directly, not via a subclass.
I experienced this problem earlier. Seems the GWT serializer doesn't like GXT model objects containing other GXT model objects, especially if one contains a collection of the other I think.
Workarounds I found couple of months ago:
1. Make your model objects inherit from BaseTreeModel instead of BaseModel
or
2. Add a dummy field to your containing model object, e.g. "private Integer private = 1;"
and make sure it implements Serializable
Try it out and tell us how it goes
How much does getting a small tattoo on your hip/stomach hurt?
Do anyone else have an itchy anus? ?
|