Sunday, May 8, 2011

Benefits of JPA over Hibernate API

There are couple of benefits of using JPA instead of hibernate, to highlight some:
  • By using the hibernate API, we are kind of bound to particular vendor. What if in future we want to use TOPLink for some particular reason, so we have to change our code a lot. But when we are using JPA, we can introduce an ORM in our project without directly depending on some particular ORM.
  • Changing from one ORM to another won't effect our DAO classes much, since we are using a standard API.

So we can use any ORM like hibernate, TOPLink. However it doesn't mean we shouldn't use hibernate. If hibernate meets your requirements use it by all means, but giving JPA more control and use hibernate for what JPA doesn't supports right now.

No comments:

Post a Comment