AI 建议直接把 JPA Entity 返回给前端,为什么数据一多就出现 N+1 查询和懒加载异常
很多 Spring Boot 项目刚开始写接口时,都会采用一种很直接的方式。
先定义实体:
Entity
public class Order {Idprivate Long id;private String orderNo;private BigDecimal totalAmount;ManyToOne(fetch FetchType.LAZY)private Customer customer;On…
2026/7/1 2:35:07