Institucion.java 1.25 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
package com.roshka.modelo;

import com.fasterxml.jackson.annotation.JsonManagedReference;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import java.util.List;

@Entity
@Table(name = "institucion")
public class Institucion {
    @Id
13
    @GeneratedValue(strategy = GenerationType.AUTO)
14 15 16 17 18 19 20 21 22 23 24 25 26 27
    @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;
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getSubNombre() {
        return subNombre;
    }

    public void setSubNombre(String subNombre) {
        this.subNombre = subNombre;
    }

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

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