JPA Best Practices
I would want to know if it is a good practise to use JpaDaoSupport. We are using EclipseLink as JPA provider currently and would want to know if it is better to move开发者_开发技巧 towards using JpaDaoSupport class.
Could someone point the advantages and disadvantages briefly?
JpaDaoSupport
is a convenient way to provide JpaTemplate
inside your DAO class.
However, JpaTemplate
is mostly redundant and Spring team recommends not to use it in new projects (use EntityManager
directly instead).
See javadoc:
JpaTemplate mainly exists as a sibling of JdoTemplate and HibernateTemplate, offering the same style for people used to it. For newly started projects, consider adopting the standard JPA style of coding data access objects instead, based on a "shared EntityManager" reference injected via a Spring bean definition or the JPA PersistenceContext annotation.
and Reference Documentation:
- 13.5.2 Implementing DAOs based on plain JPA
精彩评论