HIbernate异常错误,No row with the given identifier exists

sxf_java 2016-06-21 11:32:49
org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException : No row with the given identifier exists: [com.sunking.em.solution.domain.DispositionSolution#402880ff552a0c1f01552a27dc500002]; nested exception is org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.sunking.em.solution.domain.DispositionSolution#402880ff552a0c1f01552a27dc500002]
DispositionSolution表用的是hibernate注解形式,

package com.sunking.framework.main.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;


/**
* <p>字典内容记录字典项信息,于字典是多对一关系。</p>
* 字典有单级字典,也有多级字典。多级字典的关系使用字典内容表中的parentId来维系。
* 判断字典的级数,采用目前的方式有些困难,在使用过程中,使用CascadeCombox组件,如果存在下一级,则生成combox,否则不显示
* <p>@(#) CommonServiceImpl.java 创建日期 六 6月 05 09:46:12 +0800 2010</p>
* <p>@version 0.1 </p>
*/


@NamedQueries({
@NamedQuery(name="listDictContent",query="select t from DictContent t where t.dict.code=? and t.valided=true order by t.code asc"),
@NamedQuery(name="listAllDictContent",query="select t from DictContent t where t.dict.code=?"),
@NamedQuery(name="getDictContentByCodeOrName",query="select t from DictContent t where t.dict.dictId=? and (t.code=? or t.name=?)"),
@NamedQuery(name="codeParseChinese",query="select t from DictContent t where t.dict.code=? and t.code=?"),
@NamedQuery(name="listCommonDictContent",query="select d from DictContent d where d.dict.code=? and d.common=true and d.valided=true"),
@NamedQuery(name="getDictContentByCode" ,query="select t from DictContent t where t.code=? and t.dict.code=?")

})

@Entity
@Table(name="DictContent")
public class DictContent implements Serializable{
private String dictContentId;
private Dict dict;
private String code;
private String name;
private Date sysTime;
private DictContent parent;
private Boolean common;//是否是常用
private Boolean valided;//是否有效
@Basic
public Boolean getValided(){
return this.valided;
}
public void setValided(Boolean valided) {
this.valided=valided;
}
@Basic
public Boolean getCommon(){
return this.common;
}
public void setCommon(Boolean common) {
this.common=common;
}
@ManyToOne(targetEntity=DictContent.class,fetch=FetchType.EAGER)
@JoinColumn(name="parentid")
@NotFound(action=NotFoundAction.IGNORE)
public DictContent getParent(){
return this.parent;
}
public void setParent(DictContent parent) {
this.parent=parent;
}
@Id
@GeneratedValue(generator="system-uuid")
@GenericGenerator(name="system-uuid",strategy="uuid")
public String getDictContentId() {
return dictContentId;
}
public void setDictContentId(String dictContentId) {
this.dictContentId = dictContentId;
}
@ManyToOne(targetEntity=Dict.class,fetch=FetchType.EAGER)
@JoinColumn(name="dictId")
public Dict getDict() {
return dict;
}
public void setDict(Dict dict) {
this.dict = dict;
}
@Basic
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
@Basic
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Basic
public Date getSysTime() {
return sysTime;
}
public void setSysTime(Date sysTime) {
this.sysTime = sysTime;
}

}
...全文
772 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
阳光越来越暖 2016-06-21
  • 打赏
  • 举报
回复
应该是映射 关联关系 中 hbm.xml 关系没写好 或者实体之间的关系没写好 检查一下吧 多数出错 都是没有配置好
skgary 2016-06-21
  • 打赏
  • 举报
回复
先去数据库里查一下,是不是有这条记录。。。 然后看看,写入数据库的时候,是否真的写入了。
  • 打赏
  • 举报
回复
检查一下字段跟属性的对应
sxf_java 2016-06-21
  • 打赏
  • 举报
回复
没有hbm.xml 配置文件,是直接用注解形式

67,514

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧