JPA 2.1/Hibernate 4.3 deprecation warning

后端 未结 3 1093
無奈伤痛
無奈伤痛 2020-12-19 06:15

I\'m using JPA 2.1 sample application with Hibernate 4.3.x implementation.




        
3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-19 06:41

    By following the advice in the deprecation warning, I have found it possible to overcome this problem with a relatively tidy Spring bean creation of the Entity Manager Factory.

    Starting here:

    WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
    

    We can see the path to obtain a class compatible with javax.persistence.EntityManagerFactory from the HibernatePersistenceProvider javadocs. First you need an instance of the HibernatePersistenceProvider, then the createEntityManagerFactory method is called. Here is the Spring Bean wiring which avoids the deprecation warning:

    
    
    
       
       
    
    

    There is a Stackoverflow thread here showing the maven dependencies.

提交回复
热议问题