• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Which one is better between EntityManager and getHibernateTemplate()?

 
Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends..

in integration Spring and Hibernate.. we can use getHibernateTemplate() which provided by Spring, and we can use EntityManager also..
which one is more better?..

and what way do you ussually use?..
HibernateTemplate or EntityManager?..

Thanks in advance..
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The advantage of using an EntityManager is that it doesn't tie Spring to Hibernate. EntityManager is used in JPA, which means that any JPA container (Hibernate, Toplink...) can be used for persistence.
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Chris for your reply..

as we know, if we use EntityManager we have to use the persistence.xml..
where do we have to put the persistence.xml?..
is it on OurApplication/WEB-INF/classes/META-INF ?
or is it on OurApplication/META-INF ?

Thanks in advance..
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that it will look for META-INF/persistence.xml in the CLASSPATH. So I think you should put it under WEB-INF/classes/META-INF.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!