Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it easy to change Hibernate to JPA in an application that uses Spring?

 
Rogerio Kioshi
Ranch Hand
Posts: 690
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'd like to know if it is easy to change Hibernate to JPA in an application that uses Spring.

Thank you
 
Paul Fisher
author
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The short answer to your question is: sure! One of the missions of Spring's persistence/ORM support is portability, meaning it helps to decouple your selected persistence framework, making a transition to a different strategy far simpler. To help support this portability, Spring provides a generic exception hierarchy (allowing you to handle exceptional conditions without being tied to a persistence framework's classes), a generic transaction strategy, and a consistent approach for querying, batching, updating, etc.

Of course, when you are talking about moving from Hibernate to JPA, the transition is much simpler since these two technologies are very much related. In fact, we discuss JPA in our book, along with the question of when it makes sense to use JPA and when it is better to use Hibernate. We typically recommend the JPA annotations, whenever possible, but some of these "rules" are a bit application-specific.

Thanks for your question, and I look forward to hearing from you soon.

Best Regards,

Paul Tepper Fisher, author Spring Persistence with Hibernate
 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...what are the most common reasons one, or better a team, would
need to make this change?

Gian
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that this rarely happens, but it might happen during development, when it has been decided that an application should finally use common specifications instead of proprietary frameworks. I've never seen such a change though.
 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Christopher,

...that's what I think as well, I've seen this type of changes
happen sporadically and for very exceptional cases...and it
often entails a serious migration project.

Gian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic