Hi Noor,

In order to support polymorphism, GWT-RPC generates a serializer and
deserializer for the entire type hierarchy (all sub-classes) of any
types used as arguments or return types in a service method. The use
of Object is explicitly disallowed in RPC in order to prevent the
explosion of type serializers that would result.

Didier's workaround is a good one, as it will create serializer /
deserializer pairs only for your entities vs. for every Java class in
your app as it would if GWT were to allow Object.

/dmc

On Thu, Dec 16, 2010 at 11:45 PM, Didier Durand <[email protected]> wrote:
>
> Hi,
>
> Does the object you want to send implement Serializable ? It's
> required
>
> Then in your case when not just define
>
> class MyObject extends Object implements Serializable {
> ...
> }
>
> Then, you will be able to carry MyObject and its child classes over
> RPC.
>
> regards
>
> didier
>
> On Dec 17, 5:22 am, Noor <[email protected]> wrote:
>> Using GWT RPC, we cannot send a variable of the type OBJECT.
>>
>> I am trying to do this
>>
>> Service Interface:
>>
>> Boolean SaveObjectIntoDatabase(Object Entity);
>>
>> ServiceAsync:
>>
>> void SaveObjectIntoDatabase(Object Entity,AsyncCallback <Boolean>
>> Callback);
>>
>> This is because if we are using hibernate on the back end , we can
>> just do
>>
>> e.g.    public Boolean SaveObjectIntoDatabase(Object Entity)
>>         {
>>                 Transaction tx = null;
>>
>>                 //here we can choose about the object nature
>>                if (Entity.getClass().equals(A))
>>                 {
>>                         Entity=(A)Entity;
>>                 }
>>
>>                 if (Entity.getClass().equals(B))
>>                 {
>>                         Entity=(B)Entity;
>>                 }
>>                 //like this we can continue on saving an object
>>                 //this would be a generic fuction just for saving
>> hibernate object
>>                //making life much easier than creating an function for
>> every type of Class
>>
>>                 try
>>                 {
>>                         tx=session.beginTransaction();
>>                         tx.begin();
>>                         session.update(Entity);
>>                         tx.commit();
>>                         return true;
>>                 }
>>                 catch (Exception e)
>>                 {
>>                         tx.rollback();
>>                         e.printStackTrace();
>>                         return false;
>>                 }
>>         }
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>



-- 
David Chandler
Developer Programs Engineer, Google Web Toolkit
http://googlewebtoolkit.blogspot.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to