My Application uses MongoDb with Spring-Data.
My User.java is as follows.
User{
//other fields
@DBRef
List<Request> requests;
}
Request.java is as follows.
class Request{
@Id
private ObjectId id;
@DBRef
private User who;
@DBRef
private User whom;
@DBRef
private User group;
}
I am able to save both properly. Say my object user1 contains a list of requests and object request1 contain user1 as value for who. When i retrieve user1 object i am getting StackOverflowError. Details here. Related issue
Are there any workarounds to resolve this other than using Manual references. Are there any other API's that handles cyclic references correctly.