i will be happy to your opinions regarding - working detached in the service layer/ business layer.
For my opinion work attached in the servie layeris not a good practice since in this way we bypass the dao layer, which break the encapsulation and resposibility rule of each layer.
I dont love the attach idea, for my option save to the DB need to have single point of responsibility.
Since we begin the transaction in the service layer the objects that will returned from the DAO are in attached mode, so if we want to work detach we have several options:
1. call to evict or clear - not good , because we lose the first level cache advantage.
2. copy them to new objects - not so simple, because they have proxy ...
3. use in solutions like giled.
4. deepl clone by serialize