-
Logging request and response in your FastAPI app.
-
System Design Part – 4: Login & Sign up (Database design)
-
Machine Learning Note EP.1: Intro ML
-
LLM Intro
-
Test your webhook locally
Kotlin/Springboot/Mongodb – @DBRef bidirectional relationship causes infinite recursion exception
作者:
Takuro Huang
發佈日期:
2023 年 6 月 2 日
From my previous post here (
https://www.takurohuang.com/2023/06/02/kotlin-springboot-mongodb-dbreflazytrue-cannot-subclass-final-class-error/
), I faced those issues while using @DBRef for bidirectional relationship. The infinite recursion issue can happen even when
lazy = true
if you return the mongodb entity directly without converting it to DTO which needs to take out relationship before returning it back to client.
Beside converting it to DTO, there are also some other ways to get this issue fixed. Introduce to
@JsonManagedReference
,
@JsonBackReference
annotation from Jackson.
For more information, you can refer to this post. (
https://www.baeldung.com/jackson-bidirectional-relationships-and-infinite-recursion
)
Post Views:
188
上一篇文章
Kotlin/Springboot/Mongodb – @DBRef(lazy=true) Cannot subclass final class error
下一篇文章
SDKMan! (JDK and JVM related SDK management tool)D
搶先發佈留言