zoukankan      html  css  js  c++  java
  • org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [实体类名]

    在开发的时候用hibernate框架对两个实体建立了many-one的关系,通过id来查询数据不能查出来还报错:org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [实体类名]

    原因是建立关系的外键有空值,而且没有对映射文件中many-to-one设置not-found="ignore"导致,当然还有一种等效的注解方式,

    在实体类的中的外键上添上 @NotFound(action=NotFoundAction.IGNORE)
  • 相关阅读:
    8.8集训
    8.7集训
    8.6集训
    poj 2492
    埃氏筛法
    并查集板子
    2018级程序能力实训第二次上机考试
    网络流
    活动安排问题
    等价类
  • 原文地址:https://www.cnblogs.com/thg999/p/9927116.html
Copyright © 2011-2022 走看看