Circular Dependencies: How to handle them when serializing - franleplant/javaraptors.backend GitHub Wiki
We are going to handle circular dependencies by making all the the by directional relationships lazy, so, when you get an entity, you need to explictly get some of their properties:
Example (pseudo code):
Book book = em.getBook(id); book.getCopys(); //This will fetch all book's copys and load them in book.copys
return book; //with the uses of Jackson this will be serialized (Marshelled) into JSON and sent over the wire.