jQuery in Action, 2nd edition*
The moose likes Spring and the fly likes Spring, JPA and Albert Einstein Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring, JPA and Albert Einstein" Watch "Spring, JPA and Albert Einstein" New topic
Author

Spring, JPA and Albert Einstein

K Mansoor
Ranch Hand

Joined: Jan 10, 2006
Posts: 52
"Everything should be made as simple as possible, but not simpler." AE.

Do you agree JPA is simple enough? We don't need a template, even if it's from Spring :-)
Thank you.
Craig Walls
author
Ranch Hand

Joined: Sep 19, 2003
Posts: 301
K Mansoor wrote:Do you agree JPA is simple enough? We don't need a template, even if it's from Spring :-)
Thank you.


I'm not so sure that JPA is as simple as it could be...but yeah, it's pretty simple.

Even though Spring has a JpaTemplate, that exists for consistency's sake with the other template-based persistence options Spring offers. It's recommended practice to not use it however (or HibernateTemplate) and rely on contextual sessions instead. Effectively Spring doesn't get too involved in your JPA DAOs. You can, however, let Spring rethrow JPA-specific exceptions as one of Spring's data access exceptions, though. And you can wire up your JPA config and apply Spring-style declarative transactions when using JPA. But if you're using JpaTemplate, then you should probably look into ditching it and go with basic JPA.

BTW, that's the approach I use in the book.


Spring in Action - Unleash POJO power in your applications!
Modular Java - Discover the secret weapon to modularity on the Java platform!
XDoclet in Action - Your complete guide to code generation with XDoclet.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Spring, JPA and Albert Einstein
 
Similar Threads
What to learn after basics of servlets and JSP?
Securing a Java EE6 application with JPA
Beginner about spring should have to start with Springroo
Integrating Struts2 with Hibernate
which technology