What does Hibernate/Toplink offer above JPA?

2019-02-18 14:21发布

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?

2条回答
别忘想泡老子
2楼-- · 2019-02-18 14:53

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.

查看更多
▲ chillily
3楼-- · 2019-02-18 15:10

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)

查看更多
登录 后发表回答