首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Exception >

net.sf.hibernate.UnresolvableObjectException: No row with the given identifier e

2014-01-26 
hibernate中双向many-to-one,主表的FK的值在相关联表的PK中找不到,出现如net.sf.hibernate.UnresolvableOb

hibernate中双向many-to-one,主表的FK的值在相关联表的PK中找不到,出现如"net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists"的异常。
  但我的程序就是这个要求。主表的FK可以不存在。请问朋友们是怎么解决的?   

------解决方法--------------------------------------------------------
主表的FK可以不存在,那怎么关联到附表?
  应该是主表的FK关联到附表的PK,FK不存在难道想附表的PK也不存在?   
------解决方法--------------------------------------------------------
不可以为空吧,表之间的联系还是数据库上的操作啊,不关hibernate的事情,怎么能为没有FK呢?
 
  要不我才疏学浅,请你解释为什么hibernate里可以为空.
 
  还有你这个为什么不用many-to-many?

        

热点排行