• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Which one is better between EntityManager and getHibernateTemplate()?

 
Leonardo Carreira
Ranch Hand
Posts: 489
Eclipse IDE Java Postgres Database
  • 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..
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 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: 489
Eclipse IDE Java Postgres Database
  • 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 Ubuntu VI Editor
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic