他希望您的代码依赖于JPA,而不是Hibernate。
javax.persistence.EntityManager是JPA(Java
EE)标准接口,同时
org.hibernate.SessionFactory是Hibernate专有接口。从SessionFactory移到EntityManager会使您的类不再依赖于Hibernate。如今,大多数人认为使用JPA-
way而不是Hibernate-way是最佳实践。
Please note that your system is still dependent upon Hibernate, as you need a
JPA provider. But if you want to change to another JPA provider in the future
it should be pretty straight forward. Another advantage for going for JPA is
that the JPA-interfaces are more stable than the Hibernate ones.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)