Advertisement
andersonalmada

Untitled

Jul 8th, 2022
1,043
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1. package mandacaru3.entities;
  2.  
  3. import jakarta.persistence.Column;
  4. import jakarta.persistence.Entity;
  5. import jakarta.persistence.GeneratedValue;
  6. import jakarta.persistence.Id;
  7.  
  8. @Entity(name = "products")
  9. public class Product {
  10.  
  11.     @Id
  12.     @GeneratedValue
  13.     @Column(name = "id")
  14.     private int id;
  15.     @Column(name = "name")
  16.     private String name;
  17.     @Column(name = "price")
  18.     private double price;
  19.  
  20.     public int getId() {
  21.         return id;
  22.     }
  23.  
  24.     public void setId(int id) {
  25.         this.id = id;
  26.     }
  27.  
  28.     public String getName() {
  29.         return name;
  30.     }
  31.  
  32.     public void setName(String name) {
  33.         this.name = name;
  34.     }
  35.  
  36.     public double getPrice() {
  37.         return price;
  38.     }
  39.  
  40.     public void setPrice(double price) {
  41.         this.price = price;
  42.     }
  43.  
  44.     @Override
  45.     public String toString() {
  46.         return "Product [id=" + id + ", name=" + name + ", price=" + price + "]";
  47.     }
  48.  
  49.     public Product(int id, String name, double price) {
  50.         super();
  51.         this.id = id;
  52.         this.name = name;
  53.         this.price = price;
  54.     }
  55.  
  56.     public Product() {
  57.         super();
  58.     }
  59. }
  60.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement