-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Session vs EntityManager
PostPosted: Mon Jul 06, 2009 10:43 am 
Newbie

Joined: Mon Jul 06, 2009 10:38 am
Posts: 17
I'm currently using Hibernate annotations for a small project I am working on. I'm also using a wrapper (HibernateUtil.java) to obtain my session. I can't seem to find out the difference between using the Session vs. an EntityManager. On the outside they appear to do the same thing, give support for annotations. Is there any reason why I should use an EntityManager?


Top
 Profile  
 
 Post subject: Re: Session vs EntityManager
PostPosted: Mon Jul 06, 2009 10:49 am 
Regular
Regular

Joined: Fri Jan 30, 2009 10:10 am
Posts: 74
Location: London
Hi,

EntityManager is an object from the Java Persistence API, so if you want to leave your options open for switching between implementations of JPA, then you can developer with using EntityManagers. But it sounds as though that is not something that you are trying to achieve.


--
Stephen Souness


Top
 Profile  
 
 Post subject: Re: Session vs EntityManager
PostPosted: Mon Jul 06, 2009 10:53 am 
Newbie

Joined: Mon Jul 06, 2009 10:38 am
Posts: 17
So the difference is that session is using the Hibernate implementation and EntityManager is using the Java Persistence implementation? Is there any major advantage other than portability to using the EntityManager? I am just trying to understand the difference between the two.


Top
 Profile  
 
 Post subject: one more thing..
PostPosted: Mon Jul 06, 2009 11:28 am 
Newbie

Joined: Mon Jul 06, 2009 10:38 am
Posts: 17
To switch from using a Session to an EntityManager, assuming I have all the jars setup. Do I simply change my HibernateUtil.java to use EntityManager instead of sessionFactory and add an XML file persistense.xml to replace hibernate.cfg.xml in WEB-INF?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.