Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what exactly meant by JPA?

 
Sagar Kale
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

My question may be very silly. What exactly is meant by JPA? I see it is often used related to "hibernate with annotations" and ejb 3.0.


Is JPA a specification which is implemented by Hibernate and EJB3.0?

Thanks
 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
once upon a time there was EJB2 that really sucked and was very difficult to use, and there was Hibernate and Toplink and some other ORM technologies, and sun said ok guys our EJB2 really suck and we have to change them, and in that days Hibernate was used heavily so they asked them if they can cooperate together to make a new specification .. and they agreed.

and JPA was born. which stands for Java Persistance API, using JPA you annotate beans to be both used for hibernate and EJB3, however there are some things you can do only in hibernate so you sometimes find some annotations that are not under the javax.persistance packages such as the delete orphan in the Cascade type.

in both cases wether you are using Hibernate or EJB3 you will be using the same annotations, the difference is that in EJB3 to access those persistence objects you use an EntityManager while in Hibernate you use a Session, another difference is how transactions are managed.

hope it helps ;).
 
Sagar Kale
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Omar, Sure it will certainly help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic