1 package net.sumaris.core.model.technical.extraction;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import lombok.Data;
26 import lombok.experimental.FieldNameConstants;
27 import net.sumaris.core.dao.technical.model.IEntity;
28 import net.sumaris.core.model.referential.IItemReferentialEntity;
29 import org.hibernate.annotations.Cascade;
30
31 import javax.persistence.*;
32 import java.util.List;
33
34 @Data
35 @FieldNameConstants
36 @Entity
37 @Table(name = "extraction_product_value")
38 public class ExtractionProductValue implements IEntity<Integer> {
39
40 @Id
41 @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EXTRACTION_PRODUCT_VALUE_SEQ")
42 @SequenceGenerator(name = "EXTRACTION_PRODUCT_VALUE_SEQ", sequenceName="EXTRACTION_PRODUCT_VALUE_SEQ", allocationSize = 1)
43 private Integer id;
44
45 @Column(nullable = false, length = IItemReferentialEntity.LENGTH_LABEL)
46 private String label;
47
48 @Column(length = IItemReferentialEntity.LENGTH_NAME)
49 private String name;
50
51 @ManyToOne(fetch = FetchType.LAZY)
52 @JoinColumn(name = "extraction_product_column_fk", nullable = false)
53 private ExtractionProductColumn column;
54
55 @ManyToOne(fetch = FetchType.LAZY)
56 @JoinColumn(name = "parent_fk")
57 private ExtractionProductValue parent;
58
59 @OneToMany(fetch = FetchType.LAZY, targetEntity = ExtractionProductValue.class, mappedBy = Fields.PARENT)
60 @Cascade(org.hibernate.annotations.CascadeType.DELETE)
61 private List<ExtractionProductValue> children;
62
63 }