Is there any JPAv2-compatible vendor agnostic persistence api public available

蹲街弑〆低调 提交于 2019-12-13 17:34:33

问题


The JPA 2 maven packages I've met so far was only complete realizations either from hibernate or eclipse. But I want to build my package agains vendor agnostic api. Is it available public?


回答1:


The JPA spec group were too lazy to bother releasing a vendor neutral API jar for JPA 2.0 and JPA 2.1. See for example https://java.net/jira/browse/JPA_SPEC-60

You simply have to pick a vendor's own one and hope they didn't put vendor-specifics in there. Naff




回答2:


Take a look at org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final, org.eclipse.persistence:javax.persistence:2.1.0 or org.apache.geronimo.specs:geronimo-jpa_2.0_spec:1.1.

The Hibernate JAR has no implementation specific classes at all, the other two just contain some OSGi additions that won't do any harm when your application does not use OSGi.

While it would certainly be preferred to have an official javax.persistence:javax.persistence-api:2.x artifact, I've never had any issues compiling against the Geronimo artifact with provided scope and using my compiled artifact with different persistence providers at runtime.



来源:https://stackoverflow.com/questions/24586910/is-there-any-jpav2-compatible-vendor-agnostic-persistence-api-public-available

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!