40 lines
867 B
Java
40 lines
867 B
Java
package org.ros.chatto.model;
|
|
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
import javax.persistence.CascadeType;
|
|
import javax.persistence.Column;
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.Id;
|
|
import javax.persistence.OneToMany;
|
|
import javax.persistence.Table;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonBackReference;
|
|
|
|
import lombok.Data;
|
|
import lombok.EqualsAndHashCode;
|
|
import lombok.ToString;
|
|
|
|
|
|
@Entity
|
|
@Table(name = "roles")
|
|
@Data
|
|
public class Role {
|
|
@Id
|
|
@Column(name = "role_id")
|
|
private int roleID;
|
|
|
|
@Column(name = "role_name")
|
|
private String name;
|
|
|
|
private String description;
|
|
|
|
@OneToMany(mappedBy = "role", cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.DETACH,
|
|
CascadeType.REFRESH })
|
|
@JsonBackReference
|
|
@ToString.Exclude
|
|
@EqualsAndHashCode.Exclude
|
|
private Set<UserRole> userRoles = new HashSet<>();
|
|
}
|