Institucion.java 892 Bytes
Newer Older
1 2 3 4
package com.roshka.modelo;

import com.fasterxml.jackson.annotation.JsonManagedReference;

5 6
import lombok.Data;

7 8 9 10
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import java.util.List;

11
@Entity @Data
12 13 14
@Table(name = "institucion")
public class Institucion {
    @Id
15
    @GeneratedValue(strategy = GenerationType.IDENTITY)
16 17 18 19 20 21 22 23 24 25 26 27 28 29
    @Column(name = "id")
    private long id;

    @Column(name = "nombre")
    @NotBlank
    private String nombre;

    //Facultades
    @Column(name = "sub_nombre")
    private String subNombre;

    @OneToMany(cascade = CascadeType.PERSIST, mappedBy = "institucion", fetch = FetchType.LAZY)
    @JsonManagedReference
    private List<Estudio> estudioList;
30 31 32 33 34 35 36 37

    public List<Estudio> getEstudioList() {
        return estudioList;
    }

    public void setEstudioList(List<Estudio> estudioList) {
        this.estudioList = estudioList;
    }
38
}