79808722

Date: 2025-11-04 09:23:39
Score: 0.5
Natty:
Report link

this is the Customer entity :

@Entity
@Table(name = "customer")
public class Customer {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private String name;
    
    ...
}

OrderCreateDto :

public class OrderCreateDto {

    private LocalDate orderDate;
    private BigDecimal totalAmount;
    private Long customerId;

    ...
}

and this is the create() method in the OrderService.java class :

public OrderDto create(OrderCreateDto dto) {
    Order entity = mapper.toEntity(dto);
    Order saved = repository.save(entity);
    return mapper.toDto(saved);
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Ayoub