Thank you Joseph, I agree with you concerning the long term benefits of the DTO approach. But there are some concerns too:
- how do you make the transtyping ? Dedidcated framework like Doze ? Hand coded approach ? Direct building using HQL ? - In my experience (accounting apps) the ratio between simple CRUD screens to core business screens is 3 to 1. It means most of the time the DTO needed on the client side will be the exact mirrors of their entity counterparts. But every time you will be adding a new field, you 'll have to modify the entity, the DTO and your DTO building code/settings. So this use case (direct mirror) should be handled in a special and most efficient way. Truely yours, Le samedi 7 avril 2012 19:09:08 UTC+2, Joseph Lust a écrit : > > fabio, > > While mechanisms like *Objectify* exist to pass the same entity to the UI > from Hibernate, I have found that DTO objects are still the most robust > solution. Obviously you don't want to send the secret Hibernate goodness to > the UI, you don't want LazyLoading exceptions, and chances are the entity > has way more information than you need in the UI. Since we often have to > move a lot of information to the UI (i.e. 10K plus records) it makes sense > to use the Entity in the DAO layer and pack up the data into the DTO's in > the service layer in an efficient manner. Keep in mind too that if you pass > your entity bean to the UI, you're telling prying eyes a lot about your DB > design. > > Also, we usually use a DtoContainer object for many pages. For example, if > WidgetX needs 10 fooDTO's and 3 barDTO's, then you pack them up in a > WidgetXContainer. This is especially useful because if you decide later > that WidgetX needs 4 wombatDTO's, you whole RPC setup from interfaces, to > services, to async handlers don't need to be touched. You just add another > property to the container and then just put in and take out the new object. > > Others might push for a framework like Objectify, but my experience with > such frameworks is that you lose in the long term if you plan to do > anything beyond the purview of their limited use cases. > > Sincerely, > Joseph > -- 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/-/eQaaSkieNhkJ. 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.
