Hi Arul,

Firstly, if the warning you refer to is:

[WARN] Field 'private final
com.google.gwt.i18n.client.impl.ConstantMap.OrderedConstantSet<java.lang.String>
keys' will not be serialized because it is final

I think this has just crept into 1.5.3 somehow, there have been other
posts about this. It is AFAIK a minor bug in hosted mode but it has no
effect at all on your application - it's annoying, but just ignore it.
It has no effect on returning class instances over RPC. If however the
warning is different to that, then it is unusual and you should post
it in full.

> I am trying my level best not to change DAO pattern which is already
> exists in my application.
> There were lot of methods returns ArrayList and Vectors for different
> purpose. According to your reply now I need to change my DO as well.
>

I did not mean to suggest that. I was suggesting that you could
continue to use your DAO service that returns a Vector of Accounts as
now, but simply load the Vector into the Command DTO object (which has
a field for it) rather than directly pass the Vector itself as the RPC
return value.

regards
gregor






>   Would you please clarify one thing, if I use ArrayList or Vector
> instead a class (which implements Serilizable) as return type as you
> mentioned your reply for business methods then I am getting some
> warning like " Keys will not be Serilized because it is not final".
>  Have to use always class as return type in GWT RPC business methids
> instead traditional java programming return ( ArrayList,Vector
> etc,,)  ?
>
> Thanks
> Arul
>
> On Dec 17, 9:31 am, gregor <[email protected]> wrote:
>
> > Hi Arul,
>
> > Yes and no. Yes. this is the way you set up RPC services client side,
> > but no, you do not necessarily have to have dozens of separate
> > callbacks, one for every single use case.
>
> > For example, here you have two methods that both return vectors of
> > accounts. You can merge them into a single RPC service method (thereby
> > cutting out half the tedious callback code) using a variant of the
> > Command pattern. For example:
>
> > public class AccountsCommand implements Serializable {
>
> >    enum Operation {available, selected, ....,etc};
>
> >    private Operation op; // best made immutable
> >    private Vector<Account> accounts = new Vector<Account>();
>
> >    // constructors, getters, setters, etc
>
> > }
>
> > You set the op and dispatch one of these to a single RPC service and
> > the RPC service returns the same object that now contains the results
> > e.g.
>
> > public interface AccountsService extends RemoteService {
> >         AccountsCommand getAccounts(AccountsCommand command);
>
> > }
>
> > This is particularly convenient with enums because you can use a
> > switch statement in the (now) single callback to call the right
> > methods client side to control the UI, e,g,
>
> >   public void onSuccess(AccountsCommand command) {
> >        Command.Operation operation = command.getOperation();
> >        switch (operation) {
> >                case available: {doSomething(command.getAccounts
> > ());break;}
> >                case selected: {doSomethingElse(command.getAccounts
> > ());break;}
> >               //etc
> >         }
> > ");
>
> > which I think is quite neat and readable.  You can also easily add
> > additional fields to AccountsCommand that might become necessary/
> > desirable without altering the RPC infrastructure code at all, and
> > also any useful utility methods for manipulating lists of accounts
> > (sorting for example). I like this approach because I think it
> > maintains a strong business focus around a group of related use cases
> > at the same time as simplifying the tedious RPC infrastructure code.
>
> > regards
> > gregor
>
> > On Dec 17, 2:17 pm, Arul <[email protected]> wrote:
>
> > > Hi,
> > >    I written two business method inside service class.
> > > When I call these two methods inside client class, I have to write two
> > > seperate block containing onSuccess, onFailure methods for each of the
> > > business method in service class.
>
> > > For Example see my service class below
> > > ---------------------------------------------------------------------------­---------------------------
> > > public interface AccountsService extends RemoteService {
> > >         Vector getAvailbleAccounts();
> > >         Vector getSelectedAccounts();}
>
> > > ---------------------------------------------------------------------------­---------------------------
>
> > > Please find below my implementation (client) class for above two
> > > methods
> > > ---------------------------------------------------------------------------­--------------------------------------------------
> > > AsyncCallback<Vector> callback = new AsyncCallback<Vector>() {
> > >     public void onFailure(Throwable caught) {
> > >       System.out.println("Inside getAvailbleAccounts Error ");
>
> > >     }
>
> > >     public void onSuccess(Vector result) {
> > >         System.out.println("Inside getAvailbleAccounts On Success ");
> > >     };
> > >   accountServiceSvc.getAvailbleAccounts(callback);
>
> > > AsyncCallback<Vector> callback1 = new AsyncCallback<Vector>() {
> > >     public void onFailure(Throwable caught) {
> > >       System.out.println("Inside getSelectedAccounts Error ");
> > >     }
>
> > >     public void onSuccess(Vector result) {
> > >             System.out.println("Inside getSelectedAccounts On Success
> > > ");
> > >     }
> > >   };
> > > accountServiceSvc.getSelectedAccounts(callback1);
> > > ---------------------------------------------------------------------------­--------------------------------------------------
>
> > > Is this the way of writting blocks for every business method in GWT
> > > RPC?
>
> > > Thanks
> > > Arul- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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