I'd recommend using DTO's. Whether you use Dozer or not is secondary. The motivations for this approach are in this thread - http://groups.google.com/group/google-web-toolkit/msg/f9290388bbf5a5f8. In general, you want to keep your UI Model (i.e. DTO) separate from your Domain Model (hibernate entities). And Performance is not the only reason for this - there are going to be times when you don't want to some information to the client due to security/privacy concerns.
--Sri On 20 May 2010 16:27, Frederic Conrotte <frederic.conro...@gmail.com> wrote: > Hello > > On our current project we have a fairly large database model mapped > thru Hibernate JPA annotations: around 150 entities. > Those JPA entities have a lot of @ManyToOne, @OneToMany, @ManyToMany > inter relations. > > On the server side Hibernate lazy loading is active and managed > correctly so that no extra unneeded collections are fetched to the > client. > > I’m using Gilead in stateless mode with all JPA entities extending > java.io.Serializable and net.sf.gilead.pojo.gwt.LightEntity > > So back to the client side, I created a simple RPC Service > > @RemoteServiceRelativePath("country.rpc") > public interface CountryService extends RemoteService > { > Country findCountry(String countryId); > } > > public interface CountryServiceAsync > { > void findCountry(String countryId, AsyncCallback<Country> > callback); > } > > The Country type has several Collection fields whose type have as well > their own relations. But, again, thanks to lazy loading, those > collections are empty. > > Problem arise when I try to create the service using Development Mode > (Run As Web Application in Eclipse) > > CountryServiceAsync countryService = GWT.create(CountryService.class); > > GWT.create()'s goal is to create a client proxy for the remote > service's server side implementation. > > Extract from the "Development Mode" console: > > 12:30:18.664 [DEBUG] [project] Invoking > com.google.gwt.dev.javac.standardgeneratorcont...@904576 > 12:30:18.664 [DEBUG] [project] Generating client proxy for remote > service interface > 'com.company.project.client.services.CountryServiceClient' > 12:30:18.664 [DEBUG] [project] Analyzing > 'com.company.project.client.services.CountryServiceClient' for > serializable types > 12:30:18.664 [DEBUG] [project] Analyzing methods: > 12:30:18.664 [DEBUG] [project] public abstract > com.company.project.server.dom.Country findCountry(java.lang.String > countryId) > 12:30:18.664 [DEBUG] [project] Return type: > com.company.project.server.dom.Country > 12:30:20.648 [DEBUG] [project] com.company.project.server.dom.Country > 12:30:20.648 [DEBUG] [project] Finding possibly instantiable subtypes > . > . > . > > Then a huge tree a dependent subtypes that qualify for serialization > is built. > > At this point, GWT.create method returns after around 5 minutes ! > > Nothing mentions in the documentation that Serialization performance > depends on the number of imports of a types, including imported types > of its children: > > http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideMakingACall > > If you read this link: > > http://sinnema313.wordpress.com/2008/11/16/performance-tuning-a-gwt-application/ > > It mentions that "Serialization is slow: (...) Serialization > performance appears to be proportional to the number of objects, not > just to their total size." > > I see 2 possible solutions: > - Cache serializable types (gwt.rpc file) and load them with the > module, but I don’t know if it's feasible with current GWT API > - Use DTOs and Dozer to drastically denormalize our model object and > limit the number of inter relations between types. > > Did any of you already faced this performance problem ? > > Thanks > > Fred > > -- > 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-tool...@googlegroups.com. > To unsubscribe from this group, send email to > google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > -- 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-tool...@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.