This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using HibernateTemplate inside EJB  RSS feed

 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • 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
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!