Skip to content
Advertisement

Java JPA SpringBoot

I have table A and table B, table B have a fk that rererences to table A.

class EntityA

JavaScript

class EntityB

JavaScript

But when i try to call findAll method from repository (from EntityA) i get:

Could not write JSON: Infinite recursion

Advertisement

Answer

I’ve solved the problem using unidirectional relationship. Used this on my EntityA and erase the property entityA on EntityB.

JavaScript

The @JsonManagedReference and @JsonBackReference annotations didnt fix my problem, probably i used wrong.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement