Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.hellokoding.account.model;
- import javax.persistence.*;
- import java.util.List;
- import java.util.Set;
- @Entity
- @Table(name = "user")
- public class User {
- private Long id;
- private String username;
- private String password;
- private String passwordConfirm;
- private Set<Role> roles;
- private List<Reservation> reservation;
- @Id
- @GeneratedValue(strategy = GenerationType.AUTO)
- public Long getId() {
- return id;
- }
- @OneToMany(
- cascade = CascadeType.ALL,
- orphanRemoval = true
- )
- @JoinColumn(name = "res_id")
- public List<Reservation> getReservation() {
- return reservation;
- }
- public void setReservation(List<Reservation> reservation) {
- this.reservation = reservation;
- }
- 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;
- }
- @Transient
- public String getPasswordConfirm() {
- return passwordConfirm;
- }
- public void setPasswordConfirm(String passwordConfirm) {
- this.passwordConfirm = passwordConfirm;
- }
- @ManyToMany
- @JoinTable(name = "user_role", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id"))
- 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