Role.java 647 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package com.example.projectback.model;
  2. import org.hibernate.annotations.NaturalId;
  3. import javax.persistence.*;
  4. @Entity
  5. public class Role {
  6. @Id
  7. @GeneratedValue(strategy = GenerationType.IDENTITY)
  8. private Long id;
  9. @Enumerated(EnumType.STRING)
  10. @NaturalId
  11. private RoleName name;
  12. public Role() {
  13. }
  14. public Role(RoleName name) {
  15. this.name = name;
  16. }
  17. public Long getId() {
  18. return id;
  19. }
  20. public void setId(Long id) {
  21. this.id = id;
  22. }
  23. public RoleName getName() {
  24. return name;
  25. }
  26. public void setName(RoleName name) {
  27. this.name = name;
  28. }
  29. }