PDA

View Full Version : spring web and business layers interaction


hiberman
Aug 27th, 2005, 07:24 AM
Hi,

We have an MVC application. we're using DTO objects at web layer to collect and represent data on web forms. we also have a business layer, whose API is based on DOMAIN objects (not DTOs).
Is there any mechanism(best-practice, sample) in springframework, to provide this kind of translation (between dtos and domain objects)?

thank you , any comments welcome

klr8
Aug 27th, 2005, 07:59 AM
Springs DataBinder tries to avoid DTOs by making it possible to bind directly onto you domain layer beans. That way there is ofcourse no need for DTO <-> domain object translation. However, in some cases DTOs are a necessary evol. ASAIK Spring doesn't have direct support for this kind of thing, but take a look at the BeanWrapper, which could help you build a translator.

Erwin

sethladd
Aug 28th, 2005, 04:33 PM
This tool might help:

http://dozer.sourceforge.net/

Also, the adapter pattern might help here.