If you're talking about Hibernate, then the EntityManager and the Hibernate Session are are equivalent. You use the EntityManager if you want to use the Java Persistence API, and Hibernate's Session if you're using Hibernate's API.
There will always be people who are ahead of the curve, and people who are behind the curve. But knowledge moves the curve. --Bill James
Joined: May 20, 2008
thank you for you help
but i still have one question:
is the entitymanager used to interact with the JEB3?
What you will also see, is that Hibernate is just wrapping their Session object in their EntityManager implementation. Which is why you can always get a Session object from your EntityManager, is you want to go to the Session api.
Originally posted by jim li: thank you for you help
i believe that it is what i want to know
so based on what you said
entitymanager should be more powerful than session
since session is wrapped in entitymanager implementation, so entitymanager has everything session has, and owns some extra stuff.
am i correct?
Actually the complete opposite.
Session has more stuff to it, the EntityManager is a specification api, and the spec doesn't cover everything that Hibernate can do, so only certain methods of a Session object is called, not all of them.