Guest User

POJO

a guest
May 21st, 2017
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. @Entity
  2. public class Product {
  3.     @Id
  4.     @GeneratedValue
  5.     private long Id;
  6.     @NotBlank
  7.     private String name;
  8.     @NotNull
  9.     private int price;
  10.  
  11.     public long getId() {
  12.         return Id;
  13.     }
  14.  
  15.     public String getName() {
  16.         return name;
  17.     }
  18.  
  19.     public int getPrice() {
  20.         return price;
  21.     }
  22.  
  23.     public void setId(long id) {
  24.         Id = id;
  25.     }
  26.  
  27.     public void setName(String name) {
  28.         this.name = name;
  29.     }
  30.  
  31.     public void setPrice(int price) {
  32.         this.price = price;
  33.     }
  34.  
  35.     @Override
  36.     public String toString() {
  37.         return "Product{" +
  38.                 "Id=" + Id +
  39.                 ", name='" + name + '\'' +
  40.                 ", price=" + price +
  41.                 '}';
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment