• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate suppourt with JPA

 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am trying to create a my first simple example in JPA .

But to my surprise JPA itself is asking for an option of which ORM tool (I mean Toplink , Hibernate , ---etc)

Please tell me i dont understand this :

What is the purpose of using JPA rather than directly using Hibernate .

 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JPA is a specification. Hibernate is one of a few implementations of that specification.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much Paul , still i am having some queries n this .

But in the examples of JPA , i , dont see Hibernate is not being used anywhere but directly EntityManager methods to perform CRUD operations .

Then please let me know where exactly actually Hibernate is being used in JPA (Because all the things are performed directly by EntityManager ) .
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ravi Kiran V wrote:But in the examples of JPA , i , dont see Hibernate is not being used anywhere but directly EntityManager methods to perform CRUD operations .
Then please let me know where exactly actually Hibernate is being used in JPA (Because all the things are performed directly by EntityManager ) .


EntityManager is the heart of manipulating Entities in JPA. Hibernate provides the implementation through Hibernate Entity Manager
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Vijitha ,

But i am directly using EntityManager.persist() method .

So my question is where exactly Hibernate is being used ??

 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Vijitha says, it is being used as a JPA implementation.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Still i don't understand

There is a JPQL and not also HQL .

so actually where ??

Please provide me any link also would be okay .
 
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ravi:

There is a book titled Java Persistence with Hibernate which you would find useful.

John.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


But i am directly using EntityManager.persist() method .

So my question is where exactly Hibernate is being used ??


javax.persistence.EntityManager is an interface. Hibernate provides an implemention of that interface.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul thanks for replying .

Ya i know that

For JPA as there is EntityManager for Hibernate there is Session

and Session is also an interface .

 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Indeed. What's your point?
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Means what i think is as in case of JDBC .There is a Driver interface and the different vendors provided their own implementation class .

But EntityManager is a interface and Hibernate Session is also a interface know .



 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ravi Kiran V wrote:Means what i think is as in case of JDBC .There is a Driver interface and the different vendors provided their own implementation class .
But EntityManager is a interface and Hibernate Session is also a interface know .


Hibernate is a persistence framework on its own, you can use Hibernate directly for your persistence needs. But JPA (introduced later) is the standardization for the persistence which Hibernate provide an implementation through "Hibernate Entity Manager".
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your suppourt

The question what i am asking is

"Can't i use the JPA directly ""?? for providing persistence
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ravi Kiran V wrote:.. Can't i use the JPA directly ""?? for providing persistence


You should understand that JPA is a standardized specification for the persistence. Different vendors (Hibernate being one of them as pointed out earlier) provide implementations you can choose which to use. Of course you don't have to change your code as you are coding to a standardized specification (that is JPA).
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That makes sense .Thank you Vijitha .
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic