Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reemplazado atributo en materia por annotation en carrera #113

Merged
merged 2 commits into from
Nov 26, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ protected void generate() {
Materia materia = new Materia();
materia.setNombre("Hibernate");

materia.setCarrera(carrera);
carrera.agregarMateria(materia);
materia.setDocente(docente);
materia.setAnioEnCarrera(5);
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/ar/edu/unq/sarmiento/modelo/Carrera.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Transient;

import org.hibernate.engine.internal.Cascade;

@Entity
public class Carrera extends Persistible {

Expand All @@ -17,7 +21,8 @@ public class Carrera extends Persistible {
private String nombre;
@Transient
private List<Alumno> alumnosInscriptos = new ArrayList<>();
@OneToMany(mappedBy = "carrera")
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "carrera_id")
private List<Materia> listadoMaterias = new ArrayList<>();
private Boolean archivada= false;
private String resolucion;
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/ar/edu/unq/sarmiento/modelo/Materia.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
public class Materia extends Persistible {

private String nombre;
@ManyToOne
@JoinColumn(name="carrera")
private Carrera carrera;
@ManyToMany
private List<Materia> correlativas = new ArrayList<>();
@Type(type="yes_no")
Expand All @@ -37,14 +34,6 @@ public void setNombre(String nombre) {
this.nombre = nombre;
}

public Carrera getCarrera() {
return carrera;
}

public void setCarrera(Carrera carrera) {
this.carrera = carrera;
}

public List<Materia> getCorrelativas() {
return correlativas;
}
Expand Down