繁体   English   中英

一行在 spring 引导中重复多次 Jpa.findall() 响应 restfull api

[英]One row repeating multiple times in spring boot Jpa .findall() response restfull api

当我使用 jpaRepository 从包含外键 userId 的类别表中从我的数据库中获取数据时遇到问题。 oneToMany 的关系,数据几乎很好,但它会重复多次。 这里有一些图片: categoryServiceImpl

类别实体

json 响应

错误

这可能是由于双向关系。尝试在类别 class 中使用@JsonBackReference

@ManyToOne(fetch = FetchType.LAZY,optional= false)
@JsonBackReference
private User users;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM