Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. package com.example.postgresdemo.model;
  2.  
  3. import org.springframework.boot.context.properties.bind.DefaultValue;
  4. import org.springframework.web.bind.annotation.GetMapping;
  5.  
  6. import javax.persistence.*;
  7. import javax.validation.Valid;
  8. import javax.validation.constraints.*;
  9.  
  10. @Entity
  11. @Table(name = "pets")
  12. public class Pet {
  13. @Id
  14. @GeneratedValue(generator = "petId_generator")
  15. @SequenceGenerator(
  16. name = "petId_generator",
  17. sequenceName = "perId_sequence",
  18. initialValue = 100
  19. )
  20. private Long Id;
  21.  
  22. @Column(name = "name")
  23. @Size(min = 3, max = 15)
  24. private String Name;
  25.  
  26. @Column(name = "hp")
  27. @Max(value = 1)
  28. @Min(value = 0)
  29. private double Hp;
  30.  
  31. @Column(name = "food")
  32. @NotNull
  33. @Max(value = 1)
  34. @Min(value = 0)
  35. private double Food;
  36.  
  37. @Column(name = "happiness")
  38. @Max(value = 1)
  39. @Min(value = 0)
  40. private double Happiness;
  41.  
  42. public String getName() {
  43. return Name;
  44. }
  45.  
  46. public void setName(String name) {
  47. Name = name;
  48. }
  49.  
  50. public double getHp() {
  51. return Hp;
  52. }
  53.  
  54. public void setHp(double hp) {
  55. Hp = hp;
  56. }
  57.  
  58. public double getFood() {
  59. return Food;
  60. }
  61.  
  62. public void setFood(double food) {
  63. Food = food;
  64. }
  65.  
  66. public double getHappiness() {
  67. return Happiness;
  68. }
  69.  
  70. public void setHappiness(double happiness) {
  71. Happiness = happiness;
  72. }
  73.  
  74. public Long getId() {
  75. return Id;
  76. }
  77.  
  78. public void setId(Long Id)
  79. {
  80. this.Id = Id;
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement