Hibernate3.x异常No row with the given identifier exists 解决方法

这个异常是在 多对一关系映射时,一方表中对应的数据不存在才抛出的。
原来的配置:

<many-to-one class="com.art.model.user.UserInfo" fetch="join" name="userInfo" >
<column name="userId" unique="true"/>
</many-to-one>

修改后的:

<many-to-one class="com.art.model.user.UserInfo" fetch="join" name="userInfo" not-found="ignore">
<column name="userId" unique="true"/>
</many-to-one>

红色是修改的部分。意思是当对应的数据不存在时 忽略掉,用null值填充。该属性默认值:exception 。

时间: 2024-08-02 18:30:59

Hibernate3.x异常No row with the given identifier exists 解决方法的相关文章

Hibernate异常No row with the given identifier exists

package com.prms.urms.entity; import java.util.ArrayList; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.En

Hibernate报错:org.hibernate.ObjectNotFoundException: No row with the given identifier exists 解决办法

报错信息: org.hibernate.event.internal.DefaultLoadEventListener onLoad INFO: HHH000327: Error performing load command : org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.weixin.db.model.Adminusers#15] 报错分析: Hibernate的映射

(转)收集:Hibernate中常见问题 No row with the given identifier exists问题的原因及解决

Hibernate中No row with the given identifier exists问题的原因及解决 产生此问题的原因: 有两张表,table1和table2.产生此问题的原因就是table1里做了关联<one-to-one>或者<many-to-one unique="true">(特殊的多对一映射,实际就是一对一)来关联table2.当hibernate查找的时候,table2里的数据没有与table1相匹配的,这样就会报No row with

No row with the given identifier exists[ArtProject.Domains.Users#2]

  产生此问题的原因:              有两张表,table1和table2. 产生此问题的原因就是table1里做了关联<one-to-one>或者<many-to-one unique="true">(特殊的多对一映射,实际就是一对一)来关联table2.当hibernate查找的时候,table2里的数据没有与table1相匹配的,这样就会报No row with the given identifier exists这个错.(一句话,就是数据的

SELinux导致PHP连接MySQL异常Can&#39;t connect to MySQL server的解决方法

今天上班遇到的问题,新配的Linux服务器,php.Apache和一系列扩展插件装好后,在本地好好的程序移上去就一直抱数据库连接错误,而用sql命令却能连接上去, 做了一个简单的判断数据库连接页面还是不行,证明不是程序问题,而是php的哪里问题了,就在网上查了大半天 有些方法都不合情况后面偶然发现SELinux这个东西 查了下这个有限制httpd对外访问的权限:具体如下 输入命令:getsebool -a|grep -i httpd 里面会有一个 httpd_can_network_connec

No row with the given identifier exists

Hibernate中No row with the given identifier exists问题的原因及解决 产生此问题的原因: 有两张表,table1和table2.产生此问题的原因就是table1里做了关联<one-to-one>或者<many-to-one unique="true">(特殊的多对一映射,实际就是一对一)来关联table2.   当hibernate查找的时候,table2里的数据没有与table1相匹配的,这样就会报No row w

org.hibernate.ObjectNotFoundException: No row with the given identifier exists

维护老系统时出现的问题,出现的原因我简述一下: table1与table2是关联表,T1中有T2的主键 "T1_id",当T1中的 "T2_id" 不为null时,而T2中的"T2_id"为空,那么就会报上面这个错. 反之T1的"T2_id"为null,而T2中的"T2_id"不为null,没有任何影响. 所以这个错误是由于数据不匹配出现的. 解决方案: 1.在映射文件里加上 not-found="

hibernate出现No row with the given identifier exists问题

产生此问题的原因: 有两张表,table1和table2.产生此问题的原因就是table1里做了关联<one-to-one>或者<many-to-one>来关联table2.当hibernate查找的时候,table2里的数据没有与table1相匹配的,这样就会报No row with the given identifierexists这个错. 解决方法: 1.修改数据使关联字段能查询到数据 2.在<many-to-one>中设置not-found="ign

MySQL设置外键报错 #1452 - Cannot add or update a child row: a foreign key constraint fails 解决方法

MySQL数据库,当我尝试在A表中设置B表的主键为外键时,报出错误:#1452 - Cannot add or update a child row: a foreign key constraint fails  于是去搜索了一下 "#1452 - Cannot add or update a child row: a foreign key constraint fails" 的含义与解决方法,根据这篇博文去排查了报错原因,排除了可能1和可能2,然后去研究可能3的具体含义,一开始并