wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Pro JPA 2 - JPA for Hibernate users? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Pro JPA 2 - JPA for Hibernate users?" Watch "Pro JPA 2 - JPA for Hibernate users?" New topic
Author

Pro JPA 2 - JPA for Hibernate users?

Ayoma Wijethunga
Ranch Hand

Joined: Mar 07, 2010
Posts: 38

Hello!

Like some other developer, I'm new to JPA itself but familiar enough with Hibernate API. I have used Hibernate with Hibernate EntityManager. So I have used JPA indirectly. As Hibernate implements the Java Persistence, what is the best API, I should continue mastering? Is it better to shift to pure JPA or should I continue with Hibernate? Please let me know pros and cons of using pure JPA.

Thanks,

AyomaOnline - CodeGreed
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Ayoma Wijethunga wrote:Hello!

Like some other developer, I'm new to JPA itself but familiar enough with Hibernate API. I have used Hibernate with Hibernate EntityManager. So I have used JPA indirectly. As Hibernate implements the Java Persistence, what is the best API, I should continue mastering? Is it better to shift to pure JPA or should I continue with Hibernate? Please let me know pros and cons of using pure JPA.

Thanks,


Regardless of using Hibernate, here is the answer if you are using any JPA implementation that has more than just the SPec.

1) Use the JPA spec/annotations first.
2) If JPA doesn't have a solution for your problem, then go down the the products own api and use their solution.
3) When using non JPA annotations, make sure you show the entire package structure, so that later if you ever change JPA implementations, you know which annotations (The ones with full package) that you need to change.

Hope that helps

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Pro JPA 2 - JPA for Hibernate users?
 
Similar Threads
Hibernate java.lang.ClassNotFoundException: javax.persistence.Cacheable
Why is JPA used with in Combination with ORM like Hibernate
Sun specific JPA in hibernate
moving from JPA standard annotations to pure hibernate annotations
A good Hibernate book or tutorial