This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
K Mansoor wrote:Do you agree JPA is simple enough? We don't need a template, even if it's from Spring :-)
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.