Point 1 and 2 are ok, or you can create multiple services if you'd like for a larger project. I keep them together, but then on the server side split out several actual server modules to handle different types of requests; the RPCServiceImpl is just a simple callout to the various modules.
But #3 is right out. First, you should never be sending SQL calls from your client, this is an enormous security hole. Anyone could then call your service with any SQL they wanted to! Secondly, passing a generic List of objects makes serialization work very poorly; GWT doesn't know the type you'll really be sending, so has to essentially allow for serialization of any type. In fact I think the compiler these days simply doesn't allow you to do that. Finally, doing this simply defeats the benefits you get from GWT's RPC mechanism, which is to provide a transparent way of making type-safe specific calls across the wire, and puts a lot of extra work on the client side to interpret all the various results you might get back. Instead, implement all the specific various accesses you want as calls in the service. Think carefully about how you really want to access the data, as you can likely limit the number of calls you actually need. For instance you can still use abstraction, ie one call to return Cars, Trains, and Planes like "List<Transport> getTransportObjects(filtering arguments)". Then do all the work to db fetch and fill the objects on the server side. Your client then gets fully qualified objects returned from the RPC code, much easier and smaller code. On Apr 12, 4:50 am, FB <[email protected]> wrote: > Hello, > > my question is about the use of RCPservice, I seen some tutorials > online but I would like to know if could be a good solution use the > RCPservice in this way: > > 1) Have just one class server/RCPserviceImp.java > 2) Have just one class client/Service.java and ServiceAsync.java > > 3) Send from the client to the server, and back from the server to > client a generic ArrayList collection that can contains every object > type... > > example 1: the client asks to the server a "Select Count(id) FROM > CARS" operation, the server response is an ArrayList with only one > item containing the amount of records > > example 2: the client asks to the server a "Select * FROM CARS" > operation, the server response is an ArrayList of Cars Objects > > example 3: the client asks to the server a "Select carModel FROM CARS" > operation, the server response is an ArrayList of Strings of all car's > names > > Thank you, F. -- 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.
