Commit 14988be1 by Joel Florentin

identity en id de los modelos.

parent e1ff3f2b
......@@ -2,6 +2,7 @@ package com.roshka;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.core.type.TypeReference;
......@@ -51,10 +52,16 @@ public class CurriculumsearchApplication {
cargoR.saveAll(cargos);
cargoR.flush();
System.out.println("Cargos Saved!");
/* TypeReference<List<Tecnologia>> typeReference5 = new TypeReference<List<Tecnologia>>(){};
inputStream = TypeReference.class.getResourceAsStream("/json/tecnologia.json");
List<Tecnologia> tecnologias= mapper.readValue(inputStream,typeReference5);
tecRepo.saveAll(tecnologias);
tecRepo.flush();
System.out.println("Cargos Saved!"); */
TypeReference<List<ConvocatoriaCargo>> typeReference4 = new TypeReference<List<ConvocatoriaCargo>>(){};
inputStream = TypeReference.class.getResourceAsStream("/json/convocatoria.json");
List<ConvocatoriaCargo> convocatorias= mapper.readValue(inputStream,typeReference4);
convR.saveAll(convocatorias);
convocatorias = convR.saveAll(convocatorias);
convR.flush();
System.out.println("convocatorias Saved!");
TypeReference<List<Postulante>> typeReference = new TypeReference<List<Postulante>>(){};
......@@ -64,7 +71,7 @@ public class CurriculumsearchApplication {
for (int i = 0; i < postulante.getPostulaciones().size(); i++) {
postulante.getPostulaciones().set(i, convR.getById(postulante.getPostulaciones().get(i).getId()));
postulante.getPostulaciones().get(i).getFechaInicio();
}
} */
......
......@@ -147,10 +147,10 @@ public class PostulanteController {
);
for (int i = 0; i < postulante.getPostulaciones().size(); i++) {
/* for (int i = 0; i < postulante.getPostulaciones().size(); i++) {
postulante.getPostulaciones().set(i, cargoRepo.getById(postulante.getPostulaciones().get(i).getId()));
}
*/
for(Estudio estudio: postulante.getEstudios()){
String nombreIns = "";
nombreIns = estudio.getInstitucion().getNombre().toLowerCase();
......
......@@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonManagedReference;
@Table(name = "cargo")
public class Cargo {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotBlank
......
......@@ -24,7 +24,7 @@ import com.roshka.utils.Helper;
@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property="@UUID")
public class ConvocatoriaCargo {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne()
......
......@@ -15,7 +15,7 @@ import com.roshka.utils.Helper;
@Table(name="estudio")
public class Estudio {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private long id;
......
......@@ -23,7 +23,7 @@ import javax.validation.constraints.Past;
@Table(name = "experiencia")
public class Experiencia {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(name = "institucion")
......
......@@ -10,7 +10,7 @@ import java.util.List;
@Table(name = "institucion")
public class Institucion {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private long id;
......
......@@ -19,7 +19,7 @@ import java.util.List;
@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property="@UUID")
public class Postulante {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="id")
private long id;
......@@ -101,7 +101,7 @@ public class Postulante {
@OneToMany(mappedBy = "postulante",cascade = CascadeType.ALL)
private List<ReferenciaPersonal> referencias;
@ManyToMany(cascade = CascadeType.ALL)
@ManyToMany()
@JoinTable(uniqueConstraints = @UniqueConstraint(columnNames = {"postulante_id","convocatoria_cargo_id"}),
joinColumns = @JoinColumn(name="postulante_id", referencedColumnName="id"),
inverseJoinColumns= @JoinColumn(name="convocatoria_cargo_id", referencedColumnName="id")
......
......@@ -21,7 +21,7 @@ uniqueConstraints=@UniqueConstraint(columnNames={"postulante_id", "tecnologia_id
public class PostulanteTecnologia {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="id")
private long id ;
......@@ -29,7 +29,7 @@ public class PostulanteTecnologia {
@Min(value = 1)
@Max(value = 5)
private Long nivel;
@ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE},optional = false)
@ManyToOne(cascade = {CascadeType.PERSIST},optional = false)
@JoinColumn
private Tecnologia tecnologia;
......
......@@ -6,7 +6,7 @@ import javax.persistence.*;
@Table(name = "recursos_humanos_user")
public class RRHHUser {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, unique = true, length = 45)
......
......@@ -16,7 +16,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference;
@Table(name = "referencia_personal")
public class ReferenciaPersonal {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotBlank
......
......@@ -12,7 +12,7 @@ import javax.validation.constraints.NotBlank;
@Entity
@Table(name="tecnologia")
public class Tecnologia {
@GeneratedValue(strategy = GenerationType.AUTO)
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@Column(name="id")
private long id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment