This week's book giveaway is in the Design and Architecture forum.
We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line!
See this thread for details.
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Spring & HIbernate Integration

 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ranchers,

Just want to know how to integrate spring & hibernate in an web application.I googled and found the following.
1. Configuring webapplicationcontext as a context listener in web.xml
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

In one of applications which we support they have used spring,hibernate & EJB also.But, i was not able to find the above configuration in web.xml.Rather i found something as follows:

<bean id="UserEJBBean" class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean" lazy-init="true">

<property name="jndiName">
<value>ManageUserEJBJNDI</value>
</property>
<property name="businessInterface">
<value>.....<package>..............ManageUserEJB</value>
</property>
<property name="lookupHomeOnStartup" value="false"/>
</bean>

I can understand from the above code, that "SimpleRemoteStatelessSessionProxyFactoryBean" is used for JNDI lookup.
From the managed bean,the lookup is as follows: Mangedbean --> EJB --> (service layer) Interface --> Impl --> DAO (Interface & Impl) --> Hibernate --> DB etc..

Now, my doubt is how spring is integrated with hibernate here?? Is there any other way??
I am really confused.
Please, please help me understand.

Thanks a lot for your time



 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hibernate is integrated into Spring by having a bean in your Spring configuration file where the class is LocalSessionFactoryBean or one of its subclasses. This is not in your web.xml.

This FactoryBean creates a Hibernate SessionFactory.

Mark
 
Don't count your weasels before they've popped. And now for a mulberry bush related tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic