Not to complicate matters but using ArrayList instead od List supposed to be better in gwt? I could have sworn that ray ryan alluded to this in his presentation.
I still don't do it because I hate seeing that in my code but still, ymmv On Oct 20, 1:03 pm, Sudeep S <[email protected]> wrote: > 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 <[email protected]> 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 <[email protected]> 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, [email protected] > >> <[email protected]> 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 [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 -~----------~----~----~----~------~----~------~--~---
