In my application\'s architecture I usually send the object or list of objects from the data access layer to the web layer via the service layer, in which these objects get
You can use Apache Commmons Beanutils. The API is
org.apache.commons.beanutils.PropertyUtilsBean.copyProperties(Object dest, Object orig).
It copies property values from the "origin" bean to the "destination" bean for all cases where the property names are the same.
Now I am going to off topic. Using DTO is mostly considered an anti-pattern in EJB3. If your DTO and your domain objects are very alike, there is really no need to duplicate codes. DTO still has merits, especially for saving network bandwidth when remote access is involved. I do not have details about your application architecture, but if the layers you talked about are logical layers and does not cross network, I do not see the need for DTO.