2 Replies Latest reply on Aug 9, 2006 4:23 AM by Taras Tratatata

    Difference between JPA and Hibernate

    Taras Tratatata Newbie

      I am not sure if it is the right place to post this question ...
      What is the difference between the Java Persistence API and Hibernate?
      I think the things go this way:
      JPA is only specification (like EJB3.0) and TopLink, Hibernate and others persistence providers are implementations of this spec. (like JBoss implements EJB3).
      The thing that makes me confussed is that the Hibernate is known to be used before JPA appeared, so can I use some kind of Hibernate sepcific syntax to provide persistence to my objects in EJB3 application? That's a little bit wierd.
      Thanks for help.

        • 1. Re: Difference between JPA and Hibernate
          Mark Menard Newbie

          I'll take a swing at this.

          Hibernate is an Object Relational framework. It is owned by JBoss. It can be used in Java Enterprise Applications, as well as in Java SE apps. It works using POJO's and a descriptor, and I think it now supports annotations, so you don't need to do the descriptor.

          JPA is a specification for persistance of POJO's. JPA makes heavy use of annotations, but it can also use an XML descriptor. JPA is not an implementation and each vendor must provide one to be JEE 5 compliant.

          JBoss has a JPA implementation that uses Hibernate under the hood. If you use JPA on JBoss you will not use Hibernate specific syntax to do your work. You would use the JPA standard stuff. JBoss will make it all work behind the scenes.