package com.myfarmer.provman.model; import lombok.Data; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.validation.constraints.NotNull; import java.util.List; @Entity @Table(name = "product") @Data public class Product { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @NotNull @Column(name = "name", nullable = false) private String name; @NotNull @Column(name = "farm_id", nullable = false) private int farmId; @Column(name = "description") private String description; @OneToMany(mappedBy = "product", fetch = FetchType.EAGER) private List<ProductPricing> productPricings; }