zoukankan      html  css  js  c++  java
  • 删除数据 DataIntegrityViolationException: notnull property references a null or transient value解决

    今天在做删除某一个数据时
    使用hibernate的getHiberbnateTemplate().delete(entity)时,报以下错误
    javax.servlet.ServletException: org.springframework.dao.DataIntegrityViolationException: not-null property references a null or transient value: com.GameServer.Entity.News.NTitle; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value: 

    这是因为我在映射文件user.hbm.xml中使用not-null="true" 这使用delete()方法是系统会根据not-null来检查相应的值。而我的entity中只用id是不为null,其余是null。因此报错。


  • 相关阅读:
    poj2240
    poj1135
    poj1062
    poj3278
    2218 补丁vs错误
    必做: 1041、1024、1077、2218、1183(较难)
    poj2828
    poj3253
    洛谷P1122 最大子树和
    1074 食物链
  • 原文地址:https://www.cnblogs.com/zhihaowang/p/10128476.html
Copyright © 2011-2022 走看看