Thursday, December 16, 2010

GWT must Allow sending a variable of type object via RPC

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 google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate