0

我想知道如果更新 oneToMany 关系是否会更改域版本。例如,有一个与 Addresses 有 OneToMany 关系的 User 实体。那么如果我更新地址列表会对用户版本有影响吗?

@Entity public class User {
    @Id @Column(name = "id") 
    @GeneratedValue 
    private Long id; 

    @OneToMany (mappedBy = "document") 
    public Set<Addresses> userAddresses; 

    @Version @Column(name="OPTLOCK") 
    public Integer getVersion() { ... } 
}
4

1 回答 1

0

不,它不会对父版本有任何影响。您应该明确强制父版本递增;请参阅LockModeType.OPTIMISTIC_FORCE_INCREMENT

于 2015-08-03T20:59:00.600 回答