Does struts 2 has some added features for working on Hibernate?
Joined: Jan 28, 2008
Actually, I don't think so. You can use hibernate with any framework, and if you use spring, it will make your life much easier. Struts 2 has its own integration with spring, but I've never heard with it having extra features for hibernate integration.
I've not used Hibernate with Spring, but I've certainly used Hibernate with Struts 2. If you google more, you would find that Hibernate does provide a filter and interceptor that could be used in Struts 2.
There is no Hibernate specific integration support. But what would you be looking for ? I'm a bit suspicous of things like hibernate support and Ajax support; I'm not sure what they can provide of much depth.
In the book, we provide a chapter that shows how to integrate Hibernate/JPA with a Struts 2 application according to best practices. This includes a OSIV mechanism to handle the lazy loading in the view issue. And it shows how to use Struts 2 Spring integration to manage JPA/Hibernate; a very powerful combo!
Chad Davis<br />Co-author of Struts 2 in Action
Joined: Apr 16, 2008
Struts is a MVC-based Presentation tier framework. It provides a skeleton with which developers can build the Controller and View components of an application.
Hibernate is an object-relational mapping framework for persisting data from the Model application. Code of the Controller and the View should not be coupled to any Hibernate syntax, any Hibernate-related tasks, any JDBC syntax or anything related to data persistence. These are distinctly different areas. [ April 29, 2008: Message edited by: James Clark ]
Originally posted by chad michael davis: This includes a OSIV mechanism to handle the lazy loading in the view issue.
What's the general consensus on OSIV? I've been "trained" through classical JDBC to open and close connections as quickly as possible, and so the concept of OSIV has always been a tad disquieting for me. Is this discomfort warranted in the least, or has OSIV proved to be scalable and performant in large-scale web apps using Hibernate (with Struts or otherwise)?
Originally posted by Bear Bibeault: What's the general consensus on OSIV? I've been "trained" through classical JDBC to open and close connections as quickly as possible
Well, this is true, but sometimes you need to access DB stuff from your JSPs (or whatever your view is). You can always send everything to the DB, and get rid of lazy loading, but that would put a huge load on the network, especially if you have some many to many relationships. Another thing is that keeping one connection open till the processing of the page is far better than opening and closing several connections. Connection pooling also reduces a hell lot of load, so OSIV does not really have that big overhead you might thing it has. Just don't forget to close the session/connection with the response sending. I once wrote a small article on OSIV if you'd like to see it.