I have a unidirectional many-to-many relation (with implicit table). I dont want to impact the other side of object (but want to create the mapping), hence I am not using any cascading.
In such scenario, saveUpdate works fine but merge doesnt. And for various reasons, merge is desirable over saveUpdate()
Entity code
Code:
@Entity
@Table(name = "tcr_catalog_tree")
public class TCRCatalogTree implements java.io.Serializable {
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "tcr_catalog_tree_user", joinColumns = { @JoinColumn(name = "tcr_catalog_tree_id") }, inverseJoinColumns = { @JoinColumn(name = "user_id",insertable = true, updatable=true) })
private Set<User> assignedUsers = new HashSet<User>(0);
}