try doing

List<String> clients = new ArrayList<String>();

instead of

ArrayList<String> clients = new ArrayList<String>();

On Tue, Oct 20, 2009 at 11:31 PM, Sudeep S <sudee...@gmail.com> wrote:

> I am doing something like
>
> *
>
> public
> **interface* UtilService *extends* RemoteService {
>
> Map<String, Map<String, RateCard[]>> fetchdata (Customer objCustomer);
> }
> *
>
> public
> **interface* UtilServiceAsync {*
>
> void
> *fetchData(Customer objCustomer ,AsyncCallback<Map<String, Map<String,
> Card[]>>> callback);
>
> }
> and this works without any hassles.
>
> I have even tried ArrayList ..works without a problem..
>
> but make sure all the attributes of list have implemented Serializable or
> isSerilizable interface.
> Thanks
> Sudeep
>   On Tue, Oct 20, 2009 at 9:55 AM, Ralf B <ralf.bie...@gmail.com> wrote:
>
>>
>> Your return value is an ArrayList, not a String - so much about
>> compatibility of types. However I am not sure if you can actually
>> return an ArrayList (due to the requirement to have implemented the
>> Serializable interface). Working with String[] directly will certainly
>> work but would  require you to turn your return value into a static
>> String array.
>>
>> Ralf
>>
>>
>> On Mon, Oct 19, 2009 at 4:54 PM, michael.d.clay...@hotmail.com
>> <michael.d.clay...@hotmail.com> wrote:
>> >
>> > I have an implementation method that I want to return an
>> > arraylist<String> from the DB.
>> >
>> > Here is the method:
>> >
>> > public ArrayList<String> greetClients() {
>> >                String result = "";
>> >                Connection conn = null;
>> >                Statement st = null;
>> >
>> >                String sql = "select distinct dealernumber from
>> financialaccount";
>> >                ArrayList<String> clients = new ArrayList<String>();
>> >                try{
>> >                        Class.forName("com.mysql.jdbc.Driver");
>> >                        conn =
>> DriverManager.getConnection("jdbc:mysql://localhost:3306/
>> > DB", "user", "password");
>> >                        st = conn.createStatement();
>> >                        ResultSet rs = st.executeQuery(sql);
>> >                        while(rs.next()){
>> >                                if(rs.getString(0)!=null){
>> >                                        clients.add(rs.getString(0));
>> >                                }
>> >
>> >                        }
>> >
>> >                        //System.out.println(result);
>> >                        st.close();
>> >                        conn.close();
>> >                }catch(Exception e){
>> >                        e.printStackTrace();
>> >                }
>> >
>> >
>> >                return clients;
>> >        }
>> >
>> > When I try to create the methods in the other classes; in the Service
>> > and ServiceAsync class I get this error:
>> >
>> > Return type is not compatible with the AsyncCallback parameter from
>> > GreetingServiceAsync.getClients
>> > Here is are my classes:
>> >
>> > GreetingService.java
>> > package com.appcrown.dashboard.client;
>> >
>> > import java.util.ArrayList;
>> > import java.util.List;
>> >
>> > import com.google.gwt.user.client.rpc.RemoteService;
>> > import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
>> >
>> > /**
>> >  * The client side stub for the RPC service.
>> >  */
>> > @RemoteServiceRelativePath("greet")
>> > public interface GreetingService extends RemoteService {
>> >        String greetServer(String name);
>> >        ArrayList<String> getClients(); //gives error
>> > }
>> >
>> >
>> >
>> > GreetingServiceAsync.java
>> > package com.appcrown.dashboard.client;
>> >
>> > import java.util.ArrayList;
>> >
>> > import com.google.gwt.user.client.rpc.AsyncCallback;
>> >
>> > /**
>> >  * The async counterpart of <code>GreetingService</code>.
>> >  */
>> > public interface GreetingServiceAsync {
>> >        void greetServer(String input, AsyncCallback<String> callback);
>> >        void getClients(AsyncCallback<String> callback); //gives error
>> > }
>> >
>> >
>> >
>> >
>> > >
>> >
>>
>> >>
>>
>

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

Reply via email to