dont know if what youre doing makes sense.
assuming that it does, here is an example-

===============================
CLIENT {gwt code}
===============================
public interface MyService{
   public List<MyTableRow> getTable();
   public void setTable(List<MyTableRow> rows);
}
public interface MyServiceAsync{
   public void getTable(AsyncCallback<List<MyTableRow> > callback);
   public void setTable(List<MyTableRow> rows, AsyncCallback<Void>
callback);
}
public class MyApp{
   MyServiceAsync s;
   public onModuleLoad(){
     s = GWT.create(MyService.class);
     s.endpointCrap();

     s.getTable();
  }
  AsyncCallback<List<MyTableRow>> getTableCallback = new ACB<L<M>>(){
      onSuccess(List<MyTableRow> rows){
         parse(rows);
      }
      onFailure(Throwable t){}
  }
  AsyncCallback<Void> setTableCallback = new ACB<L<M>>(){
      onSuccess(Void v){}
      onFailure(Throwable t){}
  }
}

===============================
CLIENT{gwt} AND SERVER{'real' java}
{make the build path of your java build and the build path of gwt-
compile look at this package}
===============================
public class MyTableRow{
   public final String col1;
   public final String col2;
}

===============================
SERVER{'real' java- you can use what you want here to talk to the db}
===============================
public class MyServiceImpl implements MyService{
  public List<MyTableRow> getTable(){
     return sql.queryForList(); // or whatever
  }
  pubic void setTable(List<MyTableRow> rows){
    clearTable();  // or whatever
    for(MyTableRow row : rows)
        sql.insert(row);  // or whatever
  }
}


use something like iBatis to communicate easily with your database.
You can map an object to the columns of a select or insert statement
in a procedure easily.




On Sep 10, 4:56 pm, Kevin <[EMAIL PROTECTED]> wrote:
> The following text is what I got from GWT's RCP notes, <http://
> code.google.com/webtoolkit/documentation/
> com.google.gwt.doc.DeveloperGuide.RemoteProcedureCalls.html>
>
> "For the same reason, asynchronous methods do not have return types;
> they must always return void."
>
> So, to use a method with an RPC, am I just doing the following?
>
> in .../client/table.java
>
> public void Request() /* Makes RPC */
> {
>        table = (tableServiceAsync)GWT.create(tableService.class);
>        ServiceDefTarget endpoint = (table)threatBoard;
>        endpoint.setServiceEntryPoint(GWT.getModuleBaseURL() +
> "table");
>
> }
>
> public void onModuleLoad() {
>
> ...
>
> // call loadFromTable using RPC
>
>           threatBoard.loadFromSQL(new AsyncCallback()
>           {
>                   public void onSuccess(Object result)
>                   {
>                         return;
>                   }
>                   public void onFailure(Throwable caught)
>                   {
>                         return;
>                   }
>           });
>
> // all business logic is in .../server/tableImpl
>
> I'm lost, please guide me.
>
> Thanks
>
> On Sep 10, 4:46 pm, "Jeremiah Elliott" <[EMAIL PROTECTED]> wrote:
>
> > Why make the rpc return void? Just have it return your collection.
>
> > On Wed, Sep 10, 2008 at 3:17 PM, Kevin <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > I created a GWT FlexTable, "table", and a SQL database, "database".
> > > The table adds a row of editable cells and removes a specified row. I
> > > wrote two functions: loadFromSQL and loadFromTable. The first copies
> > > what's in the database to the table. The latter copies what's in the
> > > table to the database.
>
> > > I tried to use SQL commands in my java driver under the "client"
> > > directory, however no SQL support is available. After that I knew I'd
> > > have to use RPC's. So, basically my question is, how to implement my
> > > static database class from an RPC?
>
> > > Assuming GWT supported SQL, I'd type v =  D.loadFromSQL(); (assume
> > > loadFromSQL outputs a vector). Then I'd parse v, filling up the
> > > table.
>
> > > With the RPC's, I don't know what should be returned when using a
> > > "void" async method.
>
> > > Please give me some guidance.
>
> > > Thanks,
> > > Kevin- 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