I have a situation. I'm using hibernate for my project and made the same a webservice. I have one to many mapping between Enquiry and Branch. Mean an enquiry can have one branch and one branch can have many enquiries. Pojos are as below.
Branch
public class Branch {
private int branchID;
private String branchName;
Set<Login> users;
Set<Enquiry> enquiries;
//Getter Setter
}
Enquiry
public class Enquiry {
private long enquiryID;
private String name;
private String email;
private String mobile;
private Date dob;
private Date date;
private String address;
private String other;
private Set<EnquiryResponse> responses;
private Set<Course> courses;
private Set<Source> sources;
private Branch branch;
private boolean hasHistory;
}
The system is working. But when I made my service a web-service then while converting the response to soap-response jax-ws is throwing an error saying there exists an infinite loop (which is there, branch has enquiry and enquiry has branch) This case appears in many pojos of my project. Please suggest how can i overcome this
You need to investigate javax.xml.bind.annotation.XmlIDREF and friends.