有一张Category表,一张Topic表,Topic表中有个外键cid对应Category表中的主键,我用update更新category中某条记录的其他数据时,Hibernate: update Category set name=?, description=? where cid=?
Hibernate: update Topic set cid=null where cid=? 后面这条使得Topic中的外键都断开了,求帮助,新手
------解决方案--------------------
更新category中某条记录的其他数据时,Hibernate: update Category set name=?, description=? where cid=?
下面这条Hibernate: update Topic set cid=null where cid=? 你是干嘛用的?
------解决方案--------------------
楼主的意思是这条语句是hibernate自动帮你写的吗
------解决方案--------------------
把配置文件里面改成 cascade="none"