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/-/odd9_XG1AHAJ.
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