Error applying BeanValidation relational constraints

%%%% Error Creating SessionFactory %%%%
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:306)


hibernate4.0.1

由于javax.persistence.validation.mode的属性值默认是auto,所以会出错。

在hibernate.cfg.xml里将javax.persistence.validation.mode设置为none即可。

<bean id="sessionFactory"
      class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="hibernateProperties">
        <props>
            ....
            <prop key="javax.persistence.validation.mode">none</prop>
        </props>
    </property>
</bean>

参考:

http://stackoverflow.com/questions/10883736/how-to-deal-with-error-applying-beanvalidation-relational-constraints

http://tojaoomy.iteye.com/blog/1439298

你可能感兴趣的:(Error applying BeanValidation relational constraints)