aspose file tools*
The moose likes Other Application Frameworks and the fly likes Which one is better between EntityManager and getHibernateTemplate()? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Which one is better between EntityManager and getHibernateTemplate()?" Watch "Which one is better between EntityManager and getHibernateTemplate()?" New topic
Author

Which one is better between EntityManager and getHibernateTemplate()?

Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

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..


Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

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.


[My Blog]
All roads lead to JavaRanch
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

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

Joined: Nov 24, 2005
Posts: 14687
    
  16

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Which one is better between EntityManager and getHibernateTemplate()?