I read this thread (http://forum.springframework.org/showthread.php?t=19429) with great intrest, but the OpenSessionInView vs DTO/VO debate continues.
I understand both arguments, but given a blank sheet of paper what would people go with?
I like the idea of OpenSessionInView in some ways, but putting JDBC code in a JSP would be considered bad practice, so why isn't transparant persistance as provided by OpenSessionInView with Hibernate lazy loaded collections? Clients calling methods on my business method isn't ideal, so should i just lower the scope (default, protected) to try and prevent someone calling them? What other problems do we face here?
DTO/VO also seems viable, but when I start writing the same code again and again, I really start to wonder. I do like the fact people only have access to the methods I provide them and that I can change the Business Model independantly. But again what other problems do we have.
When writing a web application from scratch (Struts, SpringMVC) which would be the better approach? What about a thick client (Swing)?
The last company I was at used DTOs and had Struts and Swing clients. It worked but was it right? There must be some kind of middle ground that can be struck. I think the question is, "is there a better way?".