• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pro JPA 2 - JPA for Hibernate users?

 
Ayoma Wijethunga
Ranch Hand
Posts: 38
Firefox Browser IntelliJ IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic