package com.itsol.quantrivanphong.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;


@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor


@Table(name = "catalogi")
public class Catalogi {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false, unique = true)
    private int id;

    @Column(name = "name", length = 128)
    private String name;

    @Column(name = "descriptions")
    private  String descriptions;


    @JsonIgnore
    @OneToMany(mappedBy = "catalogi", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    private List<News> newsList  = new ArrayList<>();


}
