我有休眠逆向工程生成的类与组合键。我想使用复合键更新我的表列(即非复合键)。我试过了,但没有例外,没有我的查询。
Query query= session.createQuery(update textvalues d set d.mytext=:newtext"+"where d.id.firstId=:firstId and d.id.secondid=:secondId ");
在这里,mytext是文本值表的一列。 firstId、secondId 是组合键。如果我单独更新 id 值,它就可以工作,但不适用于 mytext 列,但执行良好。我不擅长调试,但是当我这样做时,我得到了org.hibernate.NonUniqueResultException。
control not come after or execute after this line **session.createQuery()**
只是在黑暗中刺伤这里...
update textvalues d
set d.mytext = :newtext
where d.firstid = :firstId
and d.secondid = :secondId