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。因此报错。


  • 相关阅读:
    oracle grant 授权语句
    c# dllimport c++数据类型映射关系
    DJ下载工具
    防抖和节流
    事件处理的三个阶段
    tomcat
    java 中的xml操作
    数据库连接池
    jdbc
    Java 注解
  • 原文地址:https://www.cnblogs.com/zhihaowang/p/10128476.html
Copyright © 2011-2022 走看看