Skip to content

Commit

Permalink
[SHIBUI-1031]
Browse files Browse the repository at this point in the history
Fixed a cascade issue where deleting a user would delete the role
associated with the user.. which in turn would delete all users
associated with that role.
  • Loading branch information
Bill Smith committed Jan 7, 2019
1 parent 28729c7 commit 25dfb81
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public Role(String name, int rank) {

//Ignore properties annotation here is to prevent stack overflow recursive error during JSON serialization
@JsonIgnoreProperties("roles")
@ManyToMany(cascade = CascadeType.ALL, mappedBy = "roles", fetch = FetchType.EAGER)
@ManyToMany(mappedBy = "roles", fetch = FetchType.EAGER)
private Set<User> users = new HashSet<>();

}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class User extends AbstractAuditable {
private String role;

@JsonIgnore
@ManyToMany(cascade = CascadeType.ALL)
@ManyToMany(cascade = CascadeType.PERSIST)
@JoinTable(name = "user_role", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id"))
private Set<Role> roles = new HashSet<>();

Expand Down

0 comments on commit 25dfb81

Please sign in to comment.