Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Entity
- @Table(name = "user")
- public class User {
- @Id
- @GeneratedValue(strategy = GenerationType.AUTO)
- private Long id;
- @NotBlank
- @Column(name = "user_name", unique = true)
- private String userName;
- @Column(name = "password")
- private String password;
- @Email
- @NotBlank
- @Column(name = "email")
- private String email;
- @Column(name = "locked")
- private boolean locked;
- @Enumerated(EnumType.STRING)
- @Column(name = "role")
- private Role role;
- @ManyToOne(optional = true, fetch = FetchType.LAZY)
- @JoinColumn(name = "dealer_id", referencedColumnName = "id")
- private Dealer delaer;
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
- private List<EventLog> events;
- protected User() {
- this.events = new ArrayList<>();
- }
- /**
- * Constructor for User.
- *
- * @param userName Username of the user
- * @param password Encrypted password
- * @param email Email of the user
- * @param locked Determines if user account if locked or not
- */
- public User(@Nonnull String userName, @Nonnull String password, @Nonnull String email, boolean locked, @Nonnull Role role) {
- this();
- Preconditions.checkArgument(userName != null);
- Preconditions.checkArgument(password != null);
- Preconditions.checkArgument(email != null);
- Preconditions.checkArgument(role != null);
- this.userName = userName;
- this.password = password;
- this.email = email;
- this.locked = locked;
- this.role = role;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement