Advertisement
andersonalmada

Untitled

Jul 30th, 2022
968
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.25 KB | None | 0 0
  1. package br.ufc.mandacaru5.model;
  2.  
  3. import java.util.List;
  4.  
  5. import javax.persistence.Entity;
  6. import javax.persistence.GeneratedValue;
  7. import javax.persistence.Id;
  8. import javax.persistence.OneToMany;
  9.  
  10. @Entity
  11. public class Product {
  12.  
  13.     @Id
  14.     @GeneratedValue
  15.     private int id;
  16.     private String name;
  17.     private double price;
  18.  
  19.     @OneToMany(mappedBy = "product")
  20.     private List<Feedback> feedbacks;
  21.  
  22.     public int getId() {
  23.         return id;
  24.     }
  25.  
  26.     public void setId(int id) {
  27.         this.id = id;
  28.     }
  29.  
  30.     public String getName() {
  31.         return name;
  32.     }
  33.  
  34.     public void setName(String name) {
  35.         this.name = name;
  36.     }
  37.  
  38.     public double getPrice() {
  39.         return price;
  40.     }
  41.  
  42.     public void setPrice(double price) {
  43.         this.price = price;
  44.     }
  45.  
  46.     public List<Feedback> getFeedbacks() {
  47.         return feedbacks;
  48.     }
  49.  
  50.     public void setFeedbacks(List<Feedback> feedbacks) {
  51.         this.feedbacks = feedbacks;
  52.     }
  53.  
  54.     @Override
  55.     public String toString() {
  56.         return "Product [id=" + id + ", name=" + name + ", price=" + price + ", feedbacks=" + feedbacks + "]";
  57.     }
  58.  
  59.     public Product(int id, String name, double price, List<Feedback> feedbacks) {
  60.         super();
  61.         this.id = id;
  62.         this.name = name;
  63.         this.price = price;
  64.         this.feedbacks = feedbacks;
  65.     }
  66.  
  67.     public Product() {
  68.         super();
  69.     }
  70.  
  71. }
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement