This is going to be a little long. pls bear with me. My application consissts of two parts- the server-side code and the client side code. Client is a thick client written as a
java applet. The server code is written in
EJB and the server runs in the same network as the database server. So all the database code has to be in the server code. Right?
Now, the problem is that whenever I want to write simple functions in the client code that required to execute multiple sql statements, i have to put only those statements in the server coding and the rest(the UI related things) in the client code. This means that the logic in the function gets devided in two parts that makes it difficult to maintain.
So I want code something like this
------------------------------------------------------------------------
in the client...
------------------
public void methodInClient(){
final
String text = <textfield>.getText();
Transferable t = new Transferable(){
public Vector execute(){
String query = //construct quries based on the value of text
super.executeQuery(query);//Transferrable abstract class has
//methods like execute query.
// run multiple queries
//put the result in a vector
// return the vector.
}
};
Vector result = Transferer.transferData(t);
//do something with the result vector, say dispaly a message box to the user
}
.. And in the server code
---------------------------
public Vector executeAnySqlCodeFromClient(Transferable t){
Connection con = getDBConnection();
t.setConnection(con);
Vector res = t.execute();
return res;
}
------------------------------------------------------------------------
... In the code above Iam not trying to transfer the data in the transferable object, but the code of the newly created class itself that could be polymorphically taken by the Transferrable abstract class is the server code.
But serialization would'nt allow me to do that. This is because it requires the exact class that is serialized to be present while deserializing it. How do I Proceed?
Thanks for reading this far.....