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 -~----------~----~----~----~------~----~------~--~---