@Entity
class MyEntity {
//some properties to be explosed to REST, some not
}
I have some database classes that I want to explose via REST
using spring
.
Is it advisable to create a DTO
for each database class, copying over all properties needed to be exposed.
Because certainly some fields like the id
should never be available via rest. But these fields can maybe be annotated accordingly so they are ignored during REST offer?
Is writing DTOs still advisable today if they just serve as plain data containers that get the fields copied over from DB?