Hibernate/Toplink 比 JPA 提供什么?
据我所知,JPA 本身提供了所有闪亮的功能,如 ORM、JPQL、实体关系映射等。但我真的不明白,为什么人们在 JPA 之上使用 Hibernate 或 Toplink。
Hibernate 提供了哪些 JPA 本身没有的功能?
As far as I know, JPA itself offers all the shiny features like ORM, JPQL, entity relations mapping and so on. But I don't really understand, why do people use Hibernate or Toplink on top of JPA.
What does Hibernate offer that JPA itself doesn't have?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
JPA只是一个规范。 Hibernate 和 TopLink 是该规范的实现。
此外,JPA 规范有点弱,它仅提供 Hibernate 和 TopLink 等功能的子集。有时,希望或有必要超越 JPA 并使用底层实现的专有功能。
JPA is just a specification. Hibernate and TopLink are implementations of that specification.
Also, the JPA spec is a bit weak, it provides only a subset of the functions that the likes of Hibernate and TopLink provide. Sometimes it is desirable or necessary to go beyond JPA and use the proprietary features of the underlying implementation.
您应该与 JPA1 进行比较,然后与 JPA2(尚未最终版本,但有一个规范)进行比较,并查看您的应用程序中想要的功能,看看是否有 JPA 不支持的功能。这是评估是否可以使用纯 JPA 的唯一明智的方法。持久性技术的所有实现都有自己的附加组件,这些附加组件可能对您的应用程序非常有意义,但也可能不是。评估您的应用程序中对象之间的关系类型。首先,您是否使用接口字段? JPA 不支持接口定义的关系。 JPA1 不支持 1-N uni dir FK 关系,但这在 JPA2 中是支持的。
--Andy (DataNucleus)
You should make your comparison against JPA1, and then against JPA2 (not yet final, but there is a spec), and look at the features you want in your application to see if any are not supported by JPA. This is the only sensible way of assessing whether you can use pure JPA. All implementations of persistence technology have their own add ons that may make a whole lot of sense to your application, but they may not too. Assess your application for the types of relations you have between objects. To get you started, do you use fields that are interfaces ? JPA has no support for interface-defined relations. JPA1 has no support for 1-N uni dir FK relations, but this is in JPA2.
--Andy (DataNucleus)