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>
posted @ 2015-06-08 16:07  刘江龙  阅读(625)  评论(1编辑  收藏  举报