我收到一个名为“net.sf.json.JSONException:层次结构中有一个循环!”的 JSON 异常。
这是代码
Query q = em.createQuery("SELECT e from employee e ");
List<Employee> employeeList = q.getResultList();
JSONObject response = new JSONObject();
response.put("empList", employeeList);
这是员工实体。它有一对多的关系
public class Employee {
@Id
private String userId;
@JoinColumn(name = "T_MENTORS_userId", referencedColumnName = "userId")
private Collection<Experience> experience;
}