1 package net.sumaris.core.model.technical.optimization.taxon; 2 3 /*- 4 * #%L 5 * SUMARiS:: Core 6 * %% 7 * Copyright (C) 2018 SUMARiS Consortium 8 * %% 9 * This program is free software: you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as 11 * published by the Free Software Foundation, either version 3 of the 12 * License, or (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public 20 * License along with this program. If not, see 21 * <http://www.gnu.org/licenses/gpl-3.0.html>. 22 * #L% 23 */ 24 25 import lombok.Data; 26 import lombok.experimental.FieldNameConstants; 27 import net.sumaris.core.model.referential.taxon.TaxonGroup; 28 29 import javax.persistence.*; 30 import java.io.Serializable; 31 32 /** 33 * Table technique présentant tous les liens père/fils (directs et hérités) entre les groupes de taxons. 34 * 35 * Des liens entre chaque groupe de taxon et lui même y sont également présents, pour faciliter l'utilisation de cette table. 36 * 37 * Cette table est remplie à partir du contenu de TaxonGroup, par un procédure stockée à lancer depuis la base de données. 38 * 39 */ 40 @Data 41 @FieldNameConstants 42 @Entity 43 @Table(name = "taxon_group_hierarchy") 44 public class TaxonGroupHierarchy implements Serializable { 45 46 @Id 47 @ManyToOne(fetch = FetchType.LAZY, targetEntity = TaxonGroup.class, cascade = CascadeType.DETACH) 48 @JoinColumn(name = "parent_taxon_group_fk", nullable = false) 49 private TaxonGroup parentTaxonGroup; 50 51 @Id 52 @ManyToOne(fetch = FetchType.LAZY, targetEntity = TaxonGroup.class, cascade = CascadeType.DETACH) 53 @JoinColumn(name = "child_taxon_group_fk", nullable = false) 54 private TaxonGroup childTaxonGroup; 55 }