I have two collections, groups and permissions. The first collection works well and removes the entries which got removed from the collection. But the permissions collection does not do what it should. I always remove entries from the collection but the changes won't be updated in the DB.
@ManyToMany
@JoinTable(name = "user_groups")
private List<Group> groups = new ArrayList<Group>();
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
@OrderBy("name ASC")
private List<UserPermission> permissions = new ArrayList<UserPermission>();
The same code is used to save the Entity containing these two lists and equal code to remove the entries.