fin du merge dev->thomas sans bug

This commit is contained in:
Thomas Cardon 2022-02-15 00:05:55 +01:00
parent 6ae5799eac
commit c3ef5f63b3
5 changed files with 17 additions and 81 deletions

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}

View File

@ -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 {
}
}

View File

@ -169,19 +169,15 @@
}
},
"url": {
"raw": "localhost:8080/preference/1/3",
"host": [
"localhost"
],
"port": "8080",
"path": [
"preference",
"1",
"3"
]
}
},
@ -212,9 +208,7 @@
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"personne\": {\r\n \"id\": 1\r\n },\r\n \"restau\": {\r\n \"id\": 5\r\n },\r\n \"note\": 5,\r\n \"favoris\": true\r\n}",
"options": {
"raw": {
"language": "json"

View File

@ -73,7 +73,6 @@ insert into preference (restau_id_restau, personne_id_personne, note, favori) va
insert into preference (restau_id_restau, personne_id_personne, note, favori) values (2, 3, 3, false);
insert into preference (restau_id_restau, personne_id_personne, note, favori) values (2, 8, 3, false);
insert into type (id_type, libelle) values (1, 'Kebab');
insert into type (id_type, libelle) values (2, 'Supermarché');
insert into type (id_type, libelle) values (3, 'Boulangerie');