This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Spring and the fly likes Is it easy to change Hibernate to JPA in an application that uses Spring? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Is it easy to change Hibernate to JPA in an application that uses Spring?" Watch "Is it easy to change Hibernate to JPA in an application that uses Spring?" New topic
Author

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

Rogerio Kioshi
Ranch Hand

Joined: Apr 12, 2005
Posts: 689
Hi,

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

Thank you


SCEA 5 (part 1), SCBCD, SCWCD, SCJP, CLP, CLS
Paul Fisher
author
Greenhorn

Joined: Jul 06, 2010
Posts: 23
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

Joined: Dec 16, 2003
Posts: 977
...what are the most common reasons one, or better a team, would
need to make this change?

Gian


"Eppur si muove!"
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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.


[My Blog]
All roads lead to JavaRanch
Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
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
 
GeeCON Prague 2014
 
subject: Is it easy to change Hibernate to JPA in an application that uses Spring?