Sérialisation des models
This commit is contained in:
		
							parent
							
								
									1d7b2b9658
								
							
						
					
					
						commit
						447d2d07a7
					
				
					 5 changed files with 22 additions and 9 deletions
				
			
		|  | @ -1,5 +1,6 @@ | |||
| package fr.vincent.ramiere.mangerautourdesimplonback.models; | ||||
| 
 | ||||
| import java.io.Serializable; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Collection; | ||||
| import java.util.List; | ||||
|  | @ -15,7 +16,9 @@ import lombok.NoArgsConstructor; | |||
| @NoArgsConstructor | ||||
| @AllArgsConstructor | ||||
| @Builder | ||||
| public class Personne { | ||||
| public class Personne implements Serializable { | ||||
| 
 | ||||
|     private static final long serialVersionUID = 1L; | ||||
| 
 | ||||
|     @Id | ||||
|     @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||
|  |  | |||
|  | @ -1,5 +1,7 @@ | |||
| package fr.vincent.ramiere.mangerautourdesimplonback.models; | ||||
| 
 | ||||
| import java.io.Serializable; | ||||
| 
 | ||||
| import jakarta.persistence.Column; | ||||
| import jakarta.persistence.EmbeddedId; | ||||
| import jakarta.persistence.Entity; | ||||
|  | @ -18,7 +20,9 @@ import lombok.Setter; | |||
| @Setter | ||||
| @NoArgsConstructor | ||||
| @AllArgsConstructor | ||||
| public class Preference { | ||||
| public class Preference implements Serializable { | ||||
|     private static final long serialVersionUID = 1L; | ||||
|      | ||||
| 
 | ||||
|     // Clé primaire composite, intégrée directement dans cette entité. | ||||
|     @EmbeddedId | ||||
|  |  | |||
|  | @ -6,8 +6,8 @@ import com.fasterxml.jackson.annotation.JsonBackReference; | |||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||||
| 
 | ||||
| import jakarta.persistence.Embeddable; | ||||
| import jakarta.persistence.JoinColumn; | ||||
| import jakarta.persistence.ManyToOne; | ||||
| import jakarta.persistence.PrimaryKeyJoinColumn; | ||||
| 
 | ||||
| import lombok.AllArgsConstructor; | ||||
| import lombok.EqualsAndHashCode; | ||||
|  | @ -31,13 +31,13 @@ public class PreferencePK implements Serializable { | |||
| 
 | ||||
|     // Clé étrangère vers l'entité Personne | ||||
|     @ManyToOne | ||||
|     @PrimaryKeyJoinColumn(name = "personne_id", referencedColumnName = "id_personne") | ||||
|     @JoinColumn(name = "personne_id_personne") | ||||
|     @JsonBackReference("personne-preferencepk") | ||||
|     private transient Personne personne; | ||||
|     private Personne personne; | ||||
| 
 | ||||
|     // Clé étrangère vers l'entité Restaurant | ||||
|     @ManyToOne | ||||
| 	@PrimaryKeyJoinColumn(name="id_restau",referencedColumnName ="id_restau" ) | ||||
| 	@JoinColumn(name="restau_id_restau") | ||||
| 	@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})  | ||||
| 	private transient Restaurant restau; | ||||
| 	private Restaurant restau; | ||||
| } | ||||
|  |  | |||
|  | @ -1,5 +1,6 @@ | |||
| package fr.vincent.ramiere.mangerautourdesimplonback.models; | ||||
| 
 | ||||
| import java.io.Serializable; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Collection; | ||||
| 
 | ||||
|  | @ -17,7 +18,9 @@ import jakarta.persistence.ManyToMany; | |||
| import jakarta.persistence.OneToMany; | ||||
| 
 | ||||
| @Entity | ||||
| public class Restaurant { | ||||
| public class Restaurant implements Serializable { | ||||
| 
 | ||||
|     private static final long serialVersionUID = 1L; | ||||
|      | ||||
|     private int id; | ||||
|     private String nom; | ||||
|  |  | |||
|  | @ -1,5 +1,6 @@ | |||
| package fr.vincent.ramiere.mangerautourdesimplonback.models; | ||||
| 
 | ||||
| import java.io.Serializable; | ||||
| import java.util.List; | ||||
| 
 | ||||
| import com.fasterxml.jackson.annotation.JsonBackReference; | ||||
|  | @ -14,7 +15,9 @@ import jakarta.persistence.Table; | |||
| 
 | ||||
| @Entity | ||||
| @Table(name="type") | ||||
| public class TypeRestau { | ||||
| public class TypeRestau implements Serializable { | ||||
|      | ||||
|     private static final long serialVersionUID = 1L; | ||||
| 
 | ||||
|     private int id; | ||||
| 	private String libelle; | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue