报错:No row with the given identifier exists:13,of class:NHibe
来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/07/07 05:37:02
报错:No row with the given identifier exists:13,of class:NHibernateWebDemo.Model.Supply
源代码:
public static IList GetProductBystorstates_AllCount(int state,int audit,string keyword)
{
string hql = "select p from Product_Sup p join p.ProductType_Sup pt where p.ProductState= " + state + "and p.IsAuditing=" + audit + "and p.ProductName like '%" + keyword + "%' or pt.ProductTypeName like'%" + keyword + "%'or p.Effect like'%" + keyword + "%'" + "or p.ProductName='" + keyword + "'or p.Effect='" + keyword + "'or pt.ProductTypeName='" + keyword + "'";
return session.CreateQuery(hql).List();
}
源代码:
public static IList GetProductBystorstates_AllCount(int state,int audit,string keyword)
{
string hql = "select p from Product_Sup p join p.ProductType_Sup pt where p.ProductState= " + state + "and p.IsAuditing=" + audit + "and p.ProductName like '%" + keyword + "%' or pt.ProductTypeName like'%" + keyword + "%'or p.Effect like'%" + keyword + "%'" + "or p.ProductName='" + keyword + "'or p.Effect='" + keyword + "'or pt.ProductTypeName='" + keyword + "'";
return session.CreateQuery(hql).List();
}
![报错:No row with the given identifier exists:13,of class:NHibe](/uploads/image/z/4243648-40-8.jpg?t=%E6%8A%A5%E9%94%99%EF%BC%9ANo+row+with+the+given+identifier+exists%3A13%2Cof+class%3ANHibe)
根据PK值找数据库记录没有找到,没有办法转换成对象.请查看外键之类的数据映射.
再问: 新手,这个不怎么理解,麻烦再剖析一下,谢谢!
再答: 你的sql语句返回的是list,那应该是对象吧,所以可能存在你的记录转换成对象的时候有映射不存在。你有使用hibernate不?
再问: 有使用啊,怎么?
再答: 因为hibernate配置你某些列的时候,你肯定是配成对象了,但是有可能外键又导致找不到对应的外键列。 所以建议你检查一下你配置文件,哪些列是配置成映射为对象的,然后你要找回来的那条记录对应的那些外键的记录存在伐。 或者你可以把你的配置文件改成不是对象的。
再问: 新手,这个不怎么理解,麻烦再剖析一下,谢谢!
再答: 你的sql语句返回的是list,那应该是对象吧,所以可能存在你的记录转换成对象的时候有映射不存在。你有使用hibernate不?
再问: 有使用啊,怎么?
再答: 因为hibernate配置你某些列的时候,你肯定是配成对象了,但是有可能外键又导致找不到对应的外键列。 所以建议你检查一下你配置文件,哪些列是配置成映射为对象的,然后你要找回来的那条记录对应的那些外键的记录存在伐。 或者你可以把你的配置文件改成不是对象的。
报错:No row with the given identifier exists:13,of class:NHibe
eas和oa集成后,点击协同审批报这样的错误No row with the given identifier exist
there is no application associated with the given filename e
Complete the conversations with the proper form of the given
complete the sentences with right form of the words given
Complete the sentences with right form of the words given.
Complete the passage with right form of the given verbs.
write sentences with the proper forms of the given words.
six students stand in a row in front of the class
what do you think of the performance given by class 3 (保持句字原
英语翻译No absolute policy exists for the purchase and selection
the boss took no notice of the suggestion given bu the clerk