spring3整合hibernate4的时候遇到的问题(Error applying BeanValidation relational constraints)

来源:互联网 发布:360.cn 域名价格 编辑:程序博客网 时间:2024/05/01 12:40
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />

<property name="packagesToScan">
<list>
<value>cn.jwj.*</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.current_session_context_class">${hibernate.current_session_context_class}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
<!-- 自动建表 -->
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
</props>
</property>

</bean>


问题如图:

原因:hibernate4的自动加入验证框架 而我没配导致错误:

javax.persistence.validation.mode默认情况下是auto的,就是说如果不设置的话它是会自动去你的classpath下面找一个bean-validation**包,但是找不到,所以beanvalitionFactory错误


方法:<prop key="javax.persistence.validation.mode">none</prop>

0 0
原创粉丝点击