상품 엔티티
@Entity
@Getter @Setter
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "dtype")
public abstract class Item {
@Id @GeneratedValue
@Column(name = "item_id")
private Long id;
private String name;
private int price;
private int stockQuantity;
@ManyToMany(mappedBy = "items")
private List<Category> categories = new ArrayList<>();
}도서 엔티티
@Entity
@Getter @Setter
@DiscriminatorValue("B")
public class Book extends Item{
private String author;
private String isbn;
}음반 엔티티
영화 엔티티
Last updated