版权声明:博客知识产权来源命运的信徒,切勿侵权 https://blog.csdn.net/qq_37591637/article/details/85336251
解决方案:
在sessionFactory中加入
<prop key="javax.persistence.validation.mode">none</prop>
就可以了
我的完整代码如下
<bean id="localSessionFactoryBean"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="basicDataSource"></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="javax.persistence.validation.mode">none</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
</props>
</property>
<!-- 添加映射文件 -->
<property name="mappingLocations" value="classpath*:cn/com/bean/*.hbm.xm"></property>
</bean>