org.hibernate.ObjectNotFoundException异常一则

收到如下异常:

Caused by: javax.el.ELException: org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.darkmi.entity.system.Company#0]
at javax.el.BeanELResolver.getValue(BeanELResolver.java:298)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
at com.sun.el.parser.AstValue.getValue(AstValue.java:138)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:206)
at org.apache.jasper.runtime.PageContextImpl.evaluateExpression(PageContextImpl.java:1001)
at org.apache.jsp.WEB_002dINF.content.system.user_jsp._jspx_meth_s_iterator_0(org.apache.jsp.WEB_002dINF.content.system.user_jsp:1166)
at org.apache.js

出现以上异常,检测关联字段是否有问题,比如为空或没有与之关联的记录。

既然有外键引用就把外键约束加上,不要偷懒,有了外键约束就不会出现以上问题。

你可能感兴趣的:(Hibernate)