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

Integrating Spring and Hibernate : Help needed

Manikandan Swaminathan
Ranch Hand

Joined: Aug 10, 2008
Posts: 117
Hello ranchers,

I am bit confused in the integration of spring and hibernate.In one of our projects, they have used JSF,Spring IOC,EJB & hibernate.
So the code flow is something like this:

JSF --> valuebean/Managedbean --> EJB --> ServiceLayer (Interace & Impl class) --> DAO (Interface & Impl class) .
There are also screen objects & value objects which do the work of DTO's.

When i googled for spring & hibernate integration in the net, i got many examples which had examples like specifying the hibernate.proerties file in spring configuration file, usage of hibernate template etc. But i was not able to find anything like that in our project.But they have used some lookup configuration for EJB's in spring configuration file.

Suppose,if i am not using EJB's at all, in that case,is any other configuration required for integrating spring & hibernate? (Assuming i am using only spring IOC here..).Please advise me. I am confused on this.

Thanks
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Wrong forum to post, please wait for our moderators to move it kindly to an appropriate forum.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30506
    
150

Moving to Spring forum.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

To integrate Hibernate into Spring you would create a bean where the class is LocalSessionFactoryBean or AnnotationSessionFactoryBean, this would take place of your hibernate.cfg.xml. If using Hibernate 3.1 or higher, then you just inject your sessionFactory bean into your DAO/Repositories.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Integrating Spring and Hibernate : Help needed