Saturday, February 23, 2013

Re: Avoiding DTOs in RPC

The child DTO objects,the attributes lazily loaded are null.. when trying to access from the client side.
On server side i use hibernate.. and there i could get the child objects..
can someone tell me.. how to get those data in client side.. I could get only the parent DTO data which is returned by the RPC Async call....
I have the DTO with All attributes from model class without annotation.....
 
 

On Thursday, April 19, 2012 8:49:57 PM UTC+2, Sebastián Gurin wrote:
In a project of mine I successfully use THE SAME classes both as hibernate model and as GWT client model class using simple GWT RPC for client-server comunication: A couple of things I remember are:

1) I needed to put my DAO model classes in gwt "client" package because I work directly with this in GWT "client mode" (they need to be translated to javscript).

2) use lazy="true" in collection attribute definitions. If not, the getCollection() will return a Collection implementation not supported by GWT RPC.

3) (obvius) be careful your pojos will support RPC valid types. careful while using other framework that enrich  your model POJOS like hibernate does for collection attributes.

I don't know if this will be of use for you...

On Thu, 19 Apr 2012 08:46:07 -0700 (PDT)
Thomas Lefort <lefor...@gmail.com> wrote:

> I want to avoid having to use DTOs for transferring my Users with RPC.
> Basically I have a number of rpc calls for my users, and based on the
> configuration and the user rights, etc... there is a number of fields I
> want to hide. My approach has been to create DTOs for each case. I was now
> thinking of using the JPA relationships and lazy loading instead. For
> instance I store additional information (bio, etc...) in an "Additional"
> object, with a onetoone relationship and lazy loading. So I guess based on
> the call I just need to load the field or not, instead of filling up a
> dedicated DTO each time I send a User with "holes".
>
> Does that make sense? any one has cons on this idea? will RPC send empty
> fields or will it be more clever and just not add the fields that are null?
>
> Thanks,
>
> Thomas
>
>
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/iLFbBNp8rLAJ.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>


--
Sebastian Gurin <sgu...@softpoint.org>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment