fin du merge dev->thomas sans bug
This commit is contained in:
parent
6ae5799eac
commit
c3ef5f63b3
5 changed files with 17 additions and 81 deletions
|
|
@ -36,12 +36,6 @@ public class Personne {
|
|||
}
|
||||
|
||||
|
||||
public Personne(int id) {
|
||||
super();
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public Personne(String nom, String prenom, String email, String password) {
|
||||
super();
|
||||
this.nom = nom;
|
||||
|
|
@ -129,7 +123,4 @@ public class Personne {
|
|||
this.preference = preference;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +1,13 @@
|
|||
package fr.cardon.simpleat.model;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.IdClass;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
@Entity
|
||||
@IdClass(PreferencePK.class)
|
||||
public class Preference {
|
||||
|
||||
private Personne personne;
|
||||
private Restaurant restau;
|
||||
private PreferencePK preferencePK;
|
||||
private int note;
|
||||
private boolean favoris;
|
||||
|
||||
|
|
@ -26,79 +19,36 @@ public class Preference {
|
|||
}
|
||||
|
||||
|
||||
|
||||
public Preference(Personne personne, Restaurant restau) {
|
||||
public Preference(PreferencePK preferencePK, int note, boolean favoris) {
|
||||
super();
|
||||
this.personne = personne;
|
||||
this.restau = restau;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Preference(Personne personne, Restaurant restau, int note, boolean favoris) {
|
||||
super();
|
||||
this.personne = personne;
|
||||
this.restau = restau;
|
||||
this.preferencePK = preferencePK;
|
||||
this.note = note;
|
||||
this.favoris = favoris;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Id
|
||||
@ManyToOne
|
||||
@JoinColumn(name="id_personne" )
|
||||
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
|
||||
public Personne getPersonne() {
|
||||
return personne;
|
||||
@EmbeddedId
|
||||
public PreferencePK getPreferencePK() {
|
||||
return preferencePK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setPersonne(Personne personne) {
|
||||
this.personne = personne;
|
||||
public void setPreferencePK(PreferencePK preferencePK) {
|
||||
this.preferencePK = preferencePK;
|
||||
}
|
||||
|
||||
@Id
|
||||
@ManyToOne
|
||||
@JoinColumn(name="id_restau" )
|
||||
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
|
||||
public Restaurant getRestau() {
|
||||
return restau;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setRestau(Restaurant restau) {
|
||||
this.restau = restau;
|
||||
}
|
||||
|
||||
|
||||
@Column(nullable = true)
|
||||
public int getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setNote(int note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
|
||||
@Column(nullable = true)
|
||||
public boolean isFavoris() {
|
||||
public boolean isFavori() {
|
||||
return favoris;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setFavoris(boolean favoris) {
|
||||
public void setFavori(boolean favoris) {
|
||||
this.favoris = favoris;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package fr.cardon.simpleat.model;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Embeddable;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
|
|
@ -12,7 +13,7 @@ import javax.persistence.PrimaryKeyJoinColumn;
|
|||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
|
||||
|
||||
@Embeddable
|
||||
public class PreferencePK implements Serializable {
|
||||
|
||||
/**
|
||||
|
|
@ -48,6 +49,7 @@ public class PreferencePK implements Serializable {
|
|||
this.personne = personne;
|
||||
}
|
||||
|
||||
|
||||
@ManyToOne // TODO mappedBy preferences dans restaurant
|
||||
@PrimaryKeyJoinColumn(name="id_restau",referencedColumnName ="id_restau" )
|
||||
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
|
||||
|
|
@ -62,4 +64,4 @@ public class PreferencePK implements Serializable {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue