当前位置: 代码迷 >> Java相关 >> hibernate设置了not-null 为何无效
  详细解决方案

hibernate设置了not-null 为何无效

热度:37   发布时间:2016-04-22 20:05:52.0
hibernate设置了not-null 为什么无效?

因为设错地方了!

错误--写在了property标签里

<property name="password" type="string" length="40" not-null="true">      <column name="password" ></column></property>

正确--写在column标签里

<property name="password" type="string" >      <column name="password" length="40" not-null="true"></column></property>
  相关解决方案