'Is it better to work only with DTO or Entity in spring service layer?

I use DTO for layer movement in the communication process between client and server.

The question raised here is, when handling "business logic" in the service layer, do you use DTO or Entity?

My question is simple.

I got the number "100" from the client.

Let's say we add "50" to this.

I want to do this process in the "service layer".

If so, is it appropriate to set ter/getNum()+50 in the numberDTO received from the client?

Or, numberDTO new numberEntity(... numberDTO.getNum()+50) Is it correct to create a new Entity like ?

I know there's no right answer, but if I'm wrong, please tell me



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source