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")
private List<Location> locations;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "CLIENT_ID")
@DBRef
@Field(name = "FACTURES")
private List<Facture> factures;
}

View File

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