Here's some piece of advice.

First, If you're using the default GWT-RPC pattern, wich use the same object
type on the client side and on the server side. I think it's normal that it
doesn't work, since you're using two different object to represent the same
thing.

Second, I'll tell you what I'm using. GWT-Dispatch ! Simple implementation
of command pattern, it'll help you acheive what your searching. Personnaly,
I use the same object, but at some point with that implementation you can
control and do some "customisation" to what you want to send !

Little and simple exemple for updating a list of province :

public class UpdateProvinceHandler implements ActionHandler<UpdateProvince,
UpdateProvinceResult> {
    private Boolean result;

    public Class<UpdateProvince> getActionType() {
        return UpdateProvince.class;
    }

    public UpdateProvinceResult execute(UpdateProvince action,
ExecutionContext context) throws ActionException {
        ApapulTransaction.INSTANCE.open();

        result =
ApapulTransaction.INSTANCE.updateProvince(action.getProvince());

        ApapulTransaction.INSTANCE.close();

        return new UpdateProvinceResult(result);
    }

    public void rollback(UpdateProvince action, UpdateProvinceResult result,
ExecutionContext context) throws ActionException {
    }
}

This class is a servlet handled by Guice. Here's my guice config file :

public class ServerModule extends ActionHandlerModule {

    @Override
    protected void configureHandlers() {
        bindHandler(GetProvincesHandler.class);
        bindHandler(InsertProvinceHandler.class);
        bindHandler(RemoveProvinceHandler.class);
        bindHandler(UpdateProvinceHandler.class);

        bind(Log.class).toProvider(LogProvider.class).in(Singleton.class);
    }
}

There's also other files, but I let you read the quick start guide of the
Gwt-Dispatch project. The only thing you have to know is that when you
execute this, you will be able to transform you data from the server, to a
form that the client understand !

        ApapulTransaction.INSTANCE.open();

        result =
ApapulTransaction.INSTANCE.updateProvince(action.getProvince());

        ApapulTransaction.INSTANCE.close();

        return new UpdateProvinceResult(result);

this return a simple boolean saying Hey, Operation succeed ! Result could
have been a DTO object too, it's only a matter of use case. Oh, It Must send
back something that the client will understand, so DAO object isn't right,
do the conversion before sending that back.

Hope it'll help you, I know my server sice need a little bit of best
practice advice, but I'm starting to get a grip of all the best pratice to
do in client side ! There's four things you should get : Gin, Guice,
gwt-presenter and gwt-dispatch !

Regards

Christian

On Wed, Sep 9, 2009 at 4:07 PM, Thomas Holmes <thomas.j.hol...@gmail.com>wrote:

>
> Well ... there is another thread with this message/issue, but I can
> tell you exactly what I need.
>
> So, I've got a working Spring 2.5.6 application, we use an
> applicationContext.xml file.
> We have working and unit tested Hibernate POJO's with Annotations, and
> we have DAO's ... all defined in the Spring applicationContext.xml
> file.
> There is NO hibernate.cfg.xml file and there are NO ObjectType.hbm.xml
> files .. unfortunately a lot of samples use these.
>
> So, in testing out StockWatcher, I created a new GWT-RPC Service which
> returns one of my database objects.
> I used a Hibernate POJO and made sure that it returned all the
> serializable types, and that works great in my Service.
> I guess I need to create a new POJO that is a DTO. This new DTO object
> will look like the Hibernate POJO, but will also implement
> "isSerializable"
> Or maybe both:
>
> @Entity(name = "database_tablename")
> public class TestDataPOJO implements Serializable,IsSerializable
>
> somewhere in the TestServiceImpl (under /server) we need to call the
> database, get the data, move that to the new DTO, and that should be
> what I want.
> Likewise, I should have a method in the service that takes my modified
> data (in this DTO object), and then somehow call the DAO to put the
> data into the database.
>
> So ... the key for me ... is how do I get my GWT-RPC service, somehow,
> someway to use my already unit tested DAO's????????
>
> Once, I can bridge that, I think I will be ok ...
>
> Thanks so much for the help!
>                                                         Tom
>
> On Sep 9, 3:16 pm, Sumit Chandel <sumitchan...@google.com> wrote:
> > Hi Thomas,
> > Indeed the StockWatcher tutorial includes a section on using GWT RPC
> which
> > should help as an example in your case. The webAppCreator also generates
> a
> > starter sample application that includes a GWT RPC component as well, so
> you
> > may want to use that as a reference.
> >
> > For more specific help on using RPC for your applicaiton, it might help
> to
> > know a bit more about the types that you want to send over the wire. If
> > you're using DTOs across the wire, keeping track of objects updated on
> the
> > client and persisting the changes to the server could be a matter of
> > introducing (somewhat smelly) boolean control, a client-side register, or
> > something else. A good solution depends on the type of information you
> want
> > to send across.
> >
> > Hope that helps,
> > -Sumit Chandel
> >
> > On Sun, Sep 6, 2009 at 2:03 PM, Jim Douglas <jdoug...@basis.com> wrote:
> >
> > > Hi Thomas,
> >
> > > The tutorials are very helpful; I worked through implementing the
> > > StockWatcher sample to get my head around GWT concepts (including
> > > RPC):
> >
> > >http://code.google.com/webtoolkit/tutorials/1.6/index.html
> >
> > > On Sep 6, 1:50 pm, Thomas Holmes <thomas.j.hol...@gmail.com> wrote:
> > > > I posted this before, and I was waiting for the moderators to put
> this
> > > > online.
> > > > I am desperate, and need a working GWT-RPC working ASAP.    I've got
> 6
> > > > new books on GWT and some refer to older 1.5 versions and not the new
> > > > versions.
> >
> > > > We have Spring 2.5.6, some MVC, using Spring Beans, and Hibernate
> > > > POJO's with Annotations.
> > > > There is NO hibernate.cfg.xml and there are NO Object.hbm.xml files,
> > > > but we do have working DAO's which work great.
> >
> > > > Now ... I want to be able to take a Master/Detail (or Parent Child/
> > > > Record), bring it to the front-end, edit the data and push it back.
> > > > So, I am going to need a GWT-RPC service(s) so we can do CRUD
> > > > functionality.  All the samples I have seen use hbm.xml files and
> > > > expect a hbernate.cfg.xml which we don't have.
> >
> > > > So, if anyone can point me in the right direction with working
> > > > examples, it will be much appreciated.
> >
> > > > thanks!
> > > >                             Tom
> >
>

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