Untitled
unknown
plain_text
a year ago
1.3 kB
10
Indexable
Never
package pe.galaxy.trainning.backend.entity; import jakarta.persistence.*; import lombok.*; import java.util.Date; import java.util.HashSet; import java.util.Set; @Getter @Setter @NoArgsConstructor @AllArgsConstructor @Entity //@ToString @Table(name = "facturas") public class Factura { @Id @SequenceGenerator( name = "factura_sequence", sequenceName = "factura_sequence", initialValue = 10000, allocationSize = 1 ) @GeneratedValue( strategy = GenerationType.SEQUENCE, generator = "factura_sequence" ) @Column(name = "id") private Long id; @Column(name = "fecha") @Temporal(TemporalType.DATE) private Date fecha; @Column(name = "hora") @Temporal(TemporalType.TIME) private Date hora; @Column(name = "importe_total") private Double importeTotal; @ManyToOne( fetch = FetchType.EAGER ) @JoinColumn(name = "cliente_id") private Cliente cliente; @OneToMany( mappedBy = "factura", fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true ) private Set<FacturaProducto> facturasProductos = new HashSet<>(); }