Win a copy of TDD for a Shopping Website LiveProject this week in the Testing 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Using HibernateTemplate inside EJB

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

Hello please help me in this :

I am using Spring , EJB and Hibernate as ORM in my Application .(No JPA , there is an Hibernate dependency)

Inside my EJB



Can i use HibernateTemplate hibernateTemplate inside my EJB directly (I have configured <bean id="hibernateTemplate"> inside the applicationcontext.xml file ??

Please reply
 
ranger
Posts: 17346
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
Yes you can. But if you want your EJB to have access to your ApplicationContext you will have to do some work.

Personally, I don't use the HibernateTemplate anywhere, I just inject my SessionFactory into my DAO/Repositories. As opposed to the JdbcTemplate, the HibernateTemplate just doesn't give me anything extra that I need. I can already add one simple configuration in my xml to convert all the HibernateExceptions to Spring database exceptions, if I want that. It used to be that HibernateExceptions were checked exceptions, but they aren't anymore. My 2 cents.

Mark
 
His brain is the size of a cherry pit! About the size of this ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic