Cargo.java 1.27 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
package com.roshka.modelo;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

import com.fasterxml.jackson.annotation.JsonManagedReference;

16 17 18
import lombok.Data;

@Entity @Data
19 20 21
@Table(name = "cargo")
public class Cargo {
    @Id
22
    @GeneratedValue(strategy = GenerationType.IDENTITY)
23
    private Long id;
24 25 26 27 28

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

29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
    public Long getId() {
        return this.id;
    }

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

    public String getNombre() {
        return this.nombre;
    }

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

45 46 47 48 49 50 51 52 53 54
    @OneToMany(mappedBy = "cargo")
    @JsonManagedReference
    private List<ConvocatoriaCargo> convocatorias;

    public List<ConvocatoriaCargo> getConvocatorias() {
        return convocatorias;
    }
    public void setConvocatorias(List<ConvocatoriaCargo> convocatorias) {
        this.convocatorias = convocatorias;
    }
willgonzz committed
55 56 57
    public static Object values() {
        return null;
    }
58
}