File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes JSF + Hibernate - startup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF + Hibernate - startup" Watch "JSF + Hibernate - startup" New topic
Author

JSF + Hibernate - startup

Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
Is there a good way to have Hibernate init itself with a pure JSF app. Right now I've been using servlets + JSFs. I can easily configure one servlet to load and init the session factory on load as set by the web.xml <load-on-startup> and an override to the servlets init().

I just don't feel that overiding the FacesServlet's init is the way to go here. Any suggestions when the only servlet in my app is the FacesServlet???
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16065
    
  21

Don't put too much importance on the fact that you're using JSF. There's not that much magic there. The old tried-and-true techniques still can generally be used.

On the other hand, JSF does make it easier to tie some things together. Specifically, you can construct an application-scope bean that manages Hibernate and init things that way.

I'm using JDO, which has an architecture very similar to Hibernate's, plus I'm using Spring. Which has turned out pretty well. I use a similar technique, plus some "magic glue" that injects the Spring Beans into the JSF bean management process.


Customer surveys are for companies who didn't pay proper attention to begin with.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I too used Spring to glue Hibernate into JSF although I kept the Spring bean injection methods seperate from my JSF managed bean facilities.


GenRocket - Experts at Building Test Data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF + Hibernate - startup