-1

Some questions please :

  1. What is the JPA implementation that come with Sun JDK (7 for example) ?
  2. If my application runs on application server (JBoss for example - with Hibernate implementation I understand) , so what will be the actual implementation ? the one from the JDK or Hibernate ?
Rey Libutan
  • 5,226
  • 9
  • 42
  • 73
yryrp
  • 37
  • 8

3 Answers3

1

1) Neither JPA nor any specific JPA provider come with JDK.

2) If you run the application on JBoss, Hibernate will be used by default (it's a JBoss module). Of course, you can use whichever JPA provider you want (by specifying it in the persistence.xml and deploying the provider implementation jars).

Dragan Bozanovic
  • 23,102
  • 5
  • 43
  • 110
0

JPA is not an implementation, is just the interface. Hibernate is a JPA implementation. The thing is, if you couple your code to JPA instead of Hibernate directly, you could move to another JPA implementation with (questionable) less effort.

So 1) JDK does not come with a JPA implementation as far as I know, and 2) You would be using hibernate, but take into consideration the above comment about coupling.

Have a look at this related question for clarification about what JPA is and what JPA implementations are available: What is a JPA Provider?.

Community
  • 1
  • 1
jotadepicas
  • 2,389
  • 2
  • 26
  • 48
-1

JPA is not a implementation, its a specification or interface.

Hibernate is a JPA provider.

JPA is a specification for accessing, persisting and managing the data between Java objects and the relational database. As the definition says its API, it is only the specification. There is no implementation for the API. JPA specifies the set of rules and guidelines for developing the interfaces that follows standard. Straight to the point : JPA is just guidelines to implement the Object Relational Mapping (ORM) and there is no underlying code for the implementation. Where as, Hibernate is the actual implementation of JPA guidelines. When hibernate implements the JPA specification, this will be certified by the JPA group upon following all the standards mentioned in the specification. For example, JPA guidelines would provide information of mandatory and optional features to be implemented as part of the JPA implementation.

To answer your second question it will be your choice which ORM tool to use.

Abhijeet Dhumal
  • 1,799
  • 13
  • 24