spring - configure spring4 with hibernate5 -


i try configure spring version 4.3.1 hibernate 5 have got error when try create entity manager factory.

my hibernate version 5.0.9.final" hibernate validator version "5.2.4.final"

my dependencies

  • hibernate-core 5.0.9.final
  • hibernate-entitymanager 5.0.9.final
  • hibernate-ehcache 5.0.9
  • hibernate-validator 5.2.4.final
  • hibernate-jpa-2.1-api 1.0.0.final
  • validation-api 1.0.0.ga

this configuration :

@configuration @enabletransactionmanagement public class jpaconfiguration {  @value("classpath:hibernate.properties") private properties jpaproperties;  @resource(name = "datasource") private datasource datasource;  /**  * enable exception translation beans annotated @repository  */ @bean public persistenceexceptiontranslationpostprocessor exceptiontranslation() {     return new persistenceexceptiontranslationpostprocessor(); }  /**  * @see read http://www.springframework.org/docs/reference/transaction.html  */ @bean public jpatransactionmanager transactionmanager() {     return new jpatransactionmanager(); }  /**  * build entity manager hibernate provider.  */ @bean public localcontainerentitymanagerfactorybean entitymanagerfactory() {     localcontainerentitymanagerfactorybean emf = new localcontainerentitymanagerfactorybean();     emf.setdatasource(datasource);     // set persistencexmllocation different name make work on jboss.     emf.setpersistencexmllocation("classpath:meta-inf/spring-persistence.xml");     emf.setpersistenceunitname("mypu");     emf.setjpavendoradapter(new hibernatejpavendoradapter());     emf.setjpaproperties(jpaproperties);     emf.setjpadialect(new hibernatejpadialect());     return emf; }  @bean public sessionfactory sessionfactory(hibernateentitymanagerfactory entitymanagerfactory) {     return entitymanagerfactory.getsessionfactory(); } } 

and have got error :

    exception in thread "main" org.springframework.beans.factory.beancreationexception: error creating bean name 'entitymanagerfactory' defined in com.xxx.configuration.jpaconfiguration: invocation of init method failed; nested exception java.lang.abstractmethoderror     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1578)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:545)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:482)     @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:306)     @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230)     @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:302)     @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:197)     @ org.springframework.context.support.abstractapplicationcontext.getbean(abstractapplicationcontext.java:1076)     @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:851)     @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:541)     @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:139)     @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:83)     @ com.xxx.boot$.main(boot.scala:44)     @ com.xxx.boot.main(boot.scala)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:498)     @ com.intellij.rt.execution.application.appmain.main(appmain.java:144) caused by: java.lang.abstractmethoderror     @ org.hibernate.internal.sessionfactoryimpl.<init>(sessionfactoryimpl.java:278)     @ org.hibernate.boot.internal.sessionfactorybuilderimpl.build(sessionfactorybuilderimpl.java:444)     @ org.hibernate.jpa.boot.internal.entitymanagerfactorybuilderimpl.build(entitymanagerfactorybuilderimpl.java:879)     @ org.springframework.orm.jpa.vendor.springhibernatejpapersistenceprovider.createcontainerentitymanagerfactory(springhibernatejpapersistenceprovider.java:60)     @ org.springframework.orm.jpa.localcontainerentitymanagerfactorybean.createnativeentitymanagerfactory(localcontainerentitymanagerfactorybean.java:338)     @ org.springframework.orm.jpa.abstractentitymanagerfactorybean.buildnativeentitymanagerfactory(abstractentitymanagerfactorybean.java:373)     @ org.springframework.orm.jpa.abstractentitymanagerfactorybean.afterpropertiesset(abstractentitymanagerfactorybean.java:362)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeinitmethods(abstractautowirecapablebeanfactory.java:1637)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1574)     ... 18 more 

but when change hibernate version 5 4 works fine.

resolve:

the problem org.jadira.usertype" "usertype.core" , have got mismatch hibernate version 4 , 5.

the problem org.jadira.usertype" "usertype.core" , have got mismatch hibernate version 4 , 5 in classpath


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -