mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
cascade delete for users
This commit is contained in:
@@ -6,6 +6,8 @@ import java.util.Set;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
@@ -45,9 +47,13 @@ public class User extends AbstractModel {
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date recoverPasswordTokenDate;
|
||||
|
||||
@OneToMany(mappedBy = "user", cascade = CascadeType.PERSIST)
|
||||
@OneToMany(mappedBy = "user", cascade = { CascadeType.PERSIST,
|
||||
CascadeType.REMOVE })
|
||||
private Set<UserRole> roles = Sets.newHashSet();
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
|
||||
private Set<FeedSubscription> subscriptions;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -128,4 +134,12 @@ public class User extends AbstractModel {
|
||||
this.recoverPasswordTokenDate = recoverPasswordTokenDate;
|
||||
}
|
||||
|
||||
public Set<FeedSubscription> getSubscriptions() {
|
||||
return subscriptions;
|
||||
}
|
||||
|
||||
public void setSubscriptions(Set<FeedSubscription> subscriptions) {
|
||||
this.subscriptions = subscriptions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user