File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Hibernate" Watch "Hibernate" New topic


Abhijeet Thacker

Joined: Jan 15, 2005
Posts: 16
Please can anybody let me know that what is hibernate and how to use it with struts ?? can some one please suggest me any good book or online examples or tutorials for the same??

Always code as if person who is going to maintain your code is a maniac serial killer and knows where you live
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
HibernatePlugin for struts

Java Developer, Thailand
Matt Raible
Ranch Hand

Joined: Jan 11, 2001
Posts: 114
AppFuse ( and Equinox ( have examples of using Hibernate with Struts (and Spring!).

Matt<br /> <br />Author: <a href="" target="_blank" rel="nofollow">Spring Live</a> and <a href="" target="_blank" rel="nofollow">Pro JSP</a><br />Weblogs: <a href="" target="_blank" rel="nofollow">Raible Designs</a> <a href="" target="_blank" rel="nofollow">Spring Live Blog</a>
George Franciscus
Ranch Hand

Joined: Jan 25, 2005
Posts: 32
Hibernate is a persistence framework with a strong orientation to addressing the object-relational impedance problem. Data is stored in a relational structure, but your Java design wants to interact with them as objects. Hibernate is a tool to allow you to interact with you relational data as objects. Hibernate is good for rich domain architectures. Hibernate isn't the only persistence framework that can do that, but its very good at it.

You can either use Hibernate with Struts -or- you can use Hibernate and Struts. There's a difference.

Matt pointed out the Struts plugin that can be used to use Hibernate with Struts. Although the plugin works very well, you must resign to the fact that your Struts Action is going to know about Hibernate. If you need to switch from Hibernate to something else (say iBATIS), then you need to touch a lot of code. A better approach is to use Struts and Hibernate.

Using Struts and Hibernate means that you use them both, but neither knows about each other. The best approach to that is to create a layered application using DAOs. The DAO hides the fact that you are using Hibernate. This allows you to have an orthogonal application. That is to say, the two can co-exist, and can change without impacting each other.

You asked if there are any books on the subject. Funny you should ask that .... In Struts Recipes we present two recipes on both strategies. We have a recipe that shows how to use the Struts Hibernate plug-in. We have another recipe that shows how to create a layer Struts application. We show it both ways!

Another good approach is wiring up Struts to Spring, then wire Spring to Hibernate. Matt's book will show you how to do that.

There you have it. You asked one question and I gave you three answers. Sorry.

George Franciscus<br /><br /><a href="" target="_blank" rel="nofollow"></a><br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: Hibernate
It's not a secret anymore!