HTTP Status 500 - Could not write JSON: failed to lazily initialize a collection of role: web.entity.Boards.childBoxList, could not initialize proxy - no Session (through reference chain: web.entity.Boxes["parentBoard"]->web.entity.Boards["childBoxList"]); nested exception is org.codehaus.jackson.map.JsonMappingException: failed to lazily initialize a collection of role: web.entity.Boards.childBoxList, could not initialize proxy - no Session (through reference chain: web.entity.Boxes["parentBoard"]->web.entity.Boards["childBoxList"]) @RequestMapping (value = "/box/create/{parent}/{parentId}/{boxType}/{boxTitle}", method=RequestMethod.GET) public @ResponseBody Boxes createBox(ModelMap model, @PathVariable(value="parent") String parent, @PathVariable(value="parentId") String parentId, @PathVariable(value="boxType") String boxType, @PathVariable(value="boxTitle") String boxTitle ){ //queue //get user id from session (save id in session first) //verify for privs of user if he can create box or not. //create box in the parent board / box Boxes box = new Boxes(); box.setTitle(boxTitle); box.setType(boxType); if(parent.equals("board")){ //do this in service rather here. / that is set parent of box. Boards board = new Boards(); board = (Boards)( boardService.getBoardById(Long.valueOf(parentId)) ).getObject(); boxService.setParent(box, board); }else if(parent.equals("box")){ Boxes parentBox = new Boxes(); parentBox = (Boxes)( boxService.getBoxById(Long.valueOf(parentId)) ).getObject(); boxService.setParent(box, parentBox); } Boxes savedBox = (Boxes)boxService.save(box).getObject(); System.out.println("box saved title was "+ savedBox.getTitle()); return savedBox; } ============== @Service @Transactional(readOnly = true) public class BoxesServiceImpl implements BoxesService{ @Transactional(readOnly = false) public Boxes setParent(Boxes childBox, Boards parentBoard){ childBox.setParentBoard(parentBoard); return childBox; } @Transactional(readOnly = false) public Boxes setParent(Boxes childBox, Boxes parentBox){ childBox.setParentBox(parentBox); return childBox; } ================= @Entity public class Boards { @Id @GeneratedValue private Long id; @OneToMany @JoinTable (name = "boards_childboxes", joinColumns = @JoinColumn(name="boardId"), inverseJoinColumns = @JoinColumn(name="childBoxId") ) private Collection childBoxList = new ArrayList(); @ManyToMany private Collection boardPrivilegesList = new ArrayList(); @ManyToMany private Collection userList = new ArrayList(); @Entity public class Boxes { @Id @GeneratedValue private Long id; @ManyToOne private Boards parentBoard; @ManyToOne private Boxes parentBox; // the root box will have parentBox == null; @OneToMany @JoinTable (name = "Boxes_childboxes", joinColumns = @JoinColumn(name="BoxId"), inverseJoinColumns = @JoinColumn(name="childBoxId") ) private Collection childBoxList = new ArrayList(); // the last leaf box will have childBox == null; @OneToMany private Collection taskList = new ArrayList(); @ManyToOne private String type; // vertical / horizontal private String title; @ManyToMany private Collection userList = new ArrayList();