Mixing entity with payload (dto) in spring boot - best practice
问题 Is it good practice to have one class being both entity (mapped and stored in the database) and payload (object serialized and returned form REST endpoint) at the same time? I heard somewhere that entities should never go higher than service layer but rather should be mapped to DTO objects in services and then these DTO should be returned to controllers. I personally think this is bad practice because in such class we mix annotations for serializing to JSON and for mapping object to the