On Friday, April 20, 2012 12:59:09 PM UTC+2, -sowdri- wrote: > > Regarding the LoadFromDbServiceLayer: > > This is exactly what I was looking for. Thanks. > > Regarding pluggable mappers: > > In our applications, for each entity the actual relationship with other > object(s) is by encapsulating the instance of others (typical for ORM > layer). But in our DTOs in most cases the Id/Business Key is sufficient > instead of the whole object. > > FYI, we're doing the exact opposite: we do not use "object references" in our model but just store IDs, but we're exposing a property of an EntityProxy type on the client. We simply adopted a naming convention and an annotation: such fields are named fooId in the domain model, and exposed as a property foo on the proxy, and the field is annotated with @References(OtherEntity.class). In JPA/JDO/whataver, you'd typically have your field of type OtherEntity and let your ORM do the joins or lazy-loading or whatever. With this rule, our "LazyLoadServiceLayer" looks for a field named propertyName + "Id" and annotated with a @References annotation; if that's the case, it then uses the value of the annotation and the value of the field to load the other entity and return it. And we cache the result of the field-lookup so we don't have to do it everytime (we particularly save the fact that there's no such field!).
In your case, you'd probably simply get the property's value from the super implementation and then look for its type; and if it's an entity then you'd return its ID instead. See, it's really easy, no need for an additional "pluggable mapper". -- 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/-/G0Gz3j5eoHwJ. 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.