toni
toni

Reputation: 35

How can I represent entity inheiritance as DTO if I want to use this DTO in service layer

Let's say I am having inheritance in my entities like: Animal - parent Childs: Cat, Dog

I would like to use DTOs in my service layer and I wonder how can I represent the inheritance above as DTO? For example, I had a method like this in the service before using DTO: Animal add(Animal animal). I would like to be something like this: AnimalDTO add(AnimalDTO team)

Upvotes: 1

Views: 287

Answers (1)

João Dias
João Dias

Reputation: 17510

That is perfectly possible, just do it as you did for the entities.

Upvotes: 1

Related Questions