File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 14687
    
  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
 
wood burning stoves
 
subject: Is it easy to change Hibernate to JPA in an application that uses Spring?
 
Similar Threads
Hibernate design pattern problem
Multiple calls to struts2 action
What to learn after basics of servlets and JSP?
Hibernate and JPA with Spring
Suggest Books to learn SPRING and HIBERNATE