Spring 级联字段未更新

Spring cascade field not updated

我有一个具有以下属性的对象,但是当我尝试保存该对象时,该字段没有合并。 我该如何解决这个问题?

@ManyToMany(targetEntity = User.class, mappedBy = "userSites", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@NotAudited
private List<IUser> localIt;

用户站点:

@BatchSize(size = 20)
@ManyToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST }, fetch = FetchType.LAZY,targetEntity=Site.class)
@JoinTable(name = "USER_SITE",
joinColumns = { @JoinColumn(name = USER_ID, nullable = false) },
inverseJoinColumns = { @JoinColumn(name = "SITE_ID", nullable = false) })
private Set<ISite> userSites;

而不是保存属性:

@ManyToMany(targetEntity = User.class, mappedBy = "userSites", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@NotAudited
private List<IUser> localIt;

我更新了每个用户的站点列表,将要注册的站点添加到相关字段中:

@BatchSize(size = 20)
@ManyToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST }, fetch = FetchType.LAZY,targetEntity=Site.class)
@JoinTable(name = "USER_SITE",
joinColumns = { @JoinColumn(name = USER_ID, nullable = false) },
inverseJoinColumns = { @JoinColumn(name = "SITE_ID", nullable = false) })
private Set<ISite> userSites;