Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Struts 2 and Hibernate

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does struts 2 has some added features for working on Hibernate?
 
Ranch Hand
Posts: 471
Mac OS X Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Author
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Marshal
Posts: 67415
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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)?
 
Alaa Nassef
Ranch Hand
Posts: 471
Mac OS X Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
It's weird that we cook bacon and bake cookies. Eat this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic