4 Replies Latest reply on Jan 21, 2008 4:34 PM by Nicklas Karlsson

    using JPA vs. Hibernate with SEAM apps

    Arbi Sookazian Master

      according to EJB3 in Action by Debu et al, "JPA is now the standard API to build the persistence tier for applications." - pg. 533

      What are the advantages/disadvantages of using Hibernate (e.g. Session interface) vs. JPA (e.g. EntityManager interface) knowing that JPA is a sub-set of Hibernate API? I'm assuming you get more functionality with Hibernate API.

      http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Session.html
      http://java.sun.com/javaee/5/docs/api/javax/persistence/EntityManager.html

      We are currently using JPA with Hibernate as the persistence provider (vs. Toplink). This is different from using Hibernate API's exclusively with no EntityManager references, etc.

      persistence.xml snippet:

       <persistence-unit name="boIcomsSecurityAudit">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <jta-data-source>java:/boIcomsSecurityAuditDatasource</jta-data-source>
       <properties>
       <property name="jboss.entity.manager.factory.jndi.name" value="java:/securityAuditBoIcomsEntityManagerFactory"/>
       </properties>
       </persistence-unit>


      What is the official JBoss Seam recommendation for Seam apps? Should we use Hibernate API directly or JPA? I have a feeling it's one of the "it depends" answers. Most of the examples I've seen in the Seam books use the EntityManager interface for JPA. thx.