Correction facture

This commit is contained in:
mepiphana2023
2025-07-16 11:08:27 +02:00
parent 9bb9124617
commit bb927ff282
2 changed files with 12 additions and 12 deletions

View File

@@ -36,7 +36,7 @@ public class Client {
@Field(name = "LOCATIONS") @Field(name = "LOCATIONS")
private List<Location> locations; private List<Location> locations;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @DBRef
@JoinColumn(name = "CLIENT_ID") @Field(name = "FACTURES")
private List<Facture> factures; private List<Facture> factures;
} }

View File

@@ -1,7 +1,10 @@
package fr.eni.demo.bo; package fr.eni.demo.bo;
import jakarta.persistence.*;
import lombok.*; import lombok.*;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import java.util.Date; import java.util.Date;
@@ -12,22 +15,19 @@ import java.util.Date;
@ToString @ToString
@Builder @Builder
@Entity @Document(collection = "factures")
@Table(name="Facture")
public class Facture { public class Facture {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) private String id;
@Column(name = "FACTURE_ID")
private Long id;
@Column(name = "PRICE") @Field(name = "PRICE")
private Double price; private Double price;
@Column(name = "DATE_PAY") @Field(name = "DATEPAY")
private Date datePay; private Date datePay;
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @DBRef
@JoinColumn(name = "CLIENT_ID", nullable = false) @Field(name = "CLIENTS")
private Client client; private Client client;
} }