Java – use dto or value object patterns to calculate deferred load exceptions
•
Java
It's just an architectural problem in the Java / Hibernate / spring / MySQL stack
Should I use opensessioninview pattern or dto objects in my service layer to offset delayed loading exceptions
Is it a good habit to return domain / entity objects from the service layer? Or it is a good habit to return dto objects, which will be serialized as XML / JSON. XML in the web services layer later
Solution
I follow a very simple rule:
Dto is more or less a transformation from one domain to another This means that when I physically separate the two layers, I use dto
When you have JSP, you can use opensessioninview mode to avoid a lot of overwork, transformation model, etc
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码