假设我有一个被许多其他实体引用的 hibernate 实体。现在我创建了新实体,并且希望新实体取代旧实体,以便其他人可以引用它来代替旧实体。
最好的方法是什么?
最佳答案
最简单的方法是对引用实体使用更新语句,例如:
update ReferringEntity re set re.entity.id = :newId where re.entity.id = :oldId
关于java - 在 hibernate 中更新对实体的引用的最佳方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6135392/