zoukankan      html  css  js  c++  java
  • Error applying BeanValidation relational constraints错误的解决

    错误示例:
    Exception in thread "main" org.hibernate.HibernateException: Error applying BeanValidation relational constraints
    at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.applyRelationalConstraints(BeanValidationIntegrator.java:219)
    at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:126)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:303)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1750)
    at cn.com.zyx.model.StudentTest.main(StudentTest.java:20)
    Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.applyRelationalConstraints(BeanValidationIntegrator.java:208)
    ... 4 more
    Caused by: org.hibernate.HibernateException: Unable to build the default ValidatorFactory
    at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:524)
    at org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyDDL(TypeSafeActivator.java:119)
    ... 9 more
    Caused by: javax.validation.ValidationException: Unable to instantiate Configuration.
    at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:272)
    at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
    at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:521)
    ... 10 more
     
    在hibernate.hbm.xml中加上
    <property name="javax.persistence.validation.mode">none</property>
     
     
    javax.persistence.validation.mode默认情况下是auto的,就是说如果不设置的话它是会自动去你的classpath下面找一个bean-validation**包,但是找不到,所以beanvalitionFactory错误
  • 相关阅读:
    #include
    算法导论 Chapter 9.3 Selection in worstcase linear time
    算法导论 Exercises 9.36
    算法导论 Exercises 9.37
    C++实现Ping
    算法导论 Exercises 9.39
    如何计算毫秒级的时间差
    如何产生 [0, 2147483647] 之间的随机数
    算法导论 Exercises 9.38
    KMP算法学习&总结
  • 原文地址:https://www.cnblogs.com/WenbinChen/p/4322065.html
Copyright © 2011-2022 走看看