Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ru.example.testnew.domain;
- import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
- import javax.persistence.*;
- import java.util.Set;
- @EnableWebSecurity
- @Table(name = "usr") //Таблица Usr,а не User, чтобы случайно не занять системные названия в postgres
- public class User {
- @Id
- @GeneratedValue(strategy = GenerationType.AUTO)
- private Long id;
- private String username;
- private String password;
- private boolean active;
- @ElementCollection(targetClass = Role.class, fetch = FetchType.EAGER)
- @CollectionTable(name = "user_role", joinColumns = @JoinColumn(name = "user_id"))
- @Enumerated(EnumType.STRING)
- private Set<Role> roles;
- public Long getId() {
- return id;
- }
- public void setId(Long id) {
- this.id = id;
- }
- public String getUsername() {
- return username;
- }
- public void setUsername(String username) {
- this.username = username;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- public boolean isActive() {
- return active;
- }
- public void setActive(boolean active) {
- this.active = active;
- }
- public Set<Role> getRoles() {
- return roles;
- }
- public void setRoles(Set<Role> roles) {
- this.roles = roles;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement