We're to use DTO's to send data to and from the presentation layer.
I have a method on a service object called PostAd
which posts an advertisement entered by a user. The Ad
has an association to another object called AdValues
, which contain values for the Ad
(title, price, description etc)
@Entity
public class Ad {
@OneToMany
Set<AdValue> values ...
...
I'm wondering what is better as far as the DTO architecture goes:
have two DTO's one called
AdDTO
and the other calledAdValuesDTO
and call thePostAd
method asPostAd(AdDTO, AdValuesDTO)
~or~Have an
AdDTO
that contains theAdValuesDTO
mimicking the entity structure... this involves having DTO's within DTO's:AdDTO { Set<AdValuesDTO> adValues ...
Then the PostAd
method is called as PostAd(AdDTO)
Or is there another alternative?