What and Why JPA(Java Persistence API)?

What is JPA ? 
  • JPA is the Java Persistence API, the entity persistence model for EJB 3.0
  • Standardized persistence framework which is implemented by Hibernate (or TopLink, Cayenne, etc.)
  • JPA Annotations and persistence.xml provide vendor independent configuration
  • EntityManager provides vendor independent access to persistence
  • Replaces vendor specific query languages (HQL) with standard (JPQL)
Why JPA ?
  • JPA is the standard, and standards are good!
  • Using JPA does not tie you to Hibernate.
  • JPA gives you most of the features of plain old Hibernate, except:
  • No criteria queries in JPA 2.0. Criteria query is a neat feature of Hibernate that constructs query using Java-based combinators instead of alternate query language, getting the benefit of IntelliSense and Eclipse’s refactoring tools.
  • JPA doesn’t have Hibernate’s DeleteOrphan cascade type.                   
  • Delete Orphan is a useful annotation that directs Hibernate to deletes entities in a collection if the parent is deleted, preventing orphaning.
  • JPA doesn’t have an equivalent to Hibernate’s ScrollableResults






Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email