What jar should I include to use javax.persistence package in a hibernate based application?

后端 未结 7 1387
生来不讨喜
生来不讨喜 2020-12-29 01:20

Is it ok to take it from Glassfish project ( glassfish-persistence-api) or may be there is a Hibernate jar?

7条回答
  •  醉酒成梦
    2020-12-29 01:59

    For JPA 2.1 the javax.persistence package can be found in here:

    
       org.hibernate.javax.persistence
       hibernate-jpa-2.1-api
       1.0.0.Final
    
    

    See: hibernate-jpa-2.1-api on Maven Central The pattern seems to be to change the artefact name as the JPA version changes. If this continues new versions can be expected to arrive in Maven Central here: Hibernate JPA versions

    The above JPA 2.1 APi can be used in conjunction with Hibernate 4.3.7, specifically:

    
       org.hibernate
       hibernate-entitymanager
       4.3.7.Final
    
    

提交回复
热议问题