hibernate异常:Unable to get the default Bean Validation factor

在使用hibernat3.6.10.Final-dist 配置hibernate.cfg.xml的时候,出现了一个问题。用junit测试的时候,抛出一个异常:

org.hibernate.HibernateException: Unable to get the default Bean Validation factory
at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:127)
at org.hibernate.cfg.Configuration.applyBeanValidationConstraintsOnDDL(Configuration.java:1704)
at org.hibernate.cfg.Configuration.applyConstraintsToDDL(Configuration.java:1654)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1445)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1856)
at cn.csdn.junit.StudentTest.test(StudentTest.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

解决方案:

在hibernate.cfg.xml中配置的时候  需要这个一个属性:

 

<property name="javax.persistence.validation.mode">none</property>

猜你喜欢

转载自47585351.iteye.com/blog/2312778