Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.postgresdemo.model;
- import org.springframework.boot.context.properties.bind.DefaultValue;
- import org.springframework.web.bind.annotation.GetMapping;
- import javax.persistence.*;
- import javax.validation.Valid;
- import javax.validation.constraints.*;
- @Entity
- @Table(name = "pets")
- public class Pet {
- @Id
- @GeneratedValue(generator = "petId_generator")
- @SequenceGenerator(
- name = "petId_generator",
- sequenceName = "perId_sequence",
- initialValue = 100
- )
- private Long Id;
- @Column(name = "name")
- @Size(min = 3, max = 15)
- private String Name;
- @Column(name = "hp")
- @Max(value = 1)
- @Min(value = 0)
- private double Hp;
- @Column(name = "food")
- @NotNull
- @Max(value = 1)
- @Min(value = 0)
- private double Food;
- @Column(name = "happiness")
- @Max(value = 1)
- @Min(value = 0)
- private double Happiness;
- public String getName() {
- return Name;
- }
- public void setName(String name) {
- Name = name;
- }
- public double getHp() {
- return Hp;
- }
- public void setHp(double hp) {
- Hp = hp;
- }
- public double getFood() {
- return Food;
- }
- public void setFood(double food) {
- Food = food;
- }
- public double getHappiness() {
- return Happiness;
- }
- public void setHappiness(double happiness) {
- Happiness = happiness;
- }
- public Long getId() {
- return Id;
- }
- public void setId(Long Id)
- {
- this.Id = Id;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement