I have a Java Spring application with an Oracle DB and Hibernate. In my controller, I'm calling a DAO to retrieve some data. The DAO method proceeds until it reaches the return statement and then it fails to return to the controller. No exception is thrown. Instead, it times out. It's something like this
Controller:
@Autowired
DAO dao;
public @ResponseBody int controller(){
//stuff
System.out.println(1);
Map<Long, DBObj> objs = dao.getObjMap(ids);
System.out.println(3);
//other stuff
}
DAO:
@Transactional
public Map<Long, DBObj> getObjMap(List<Long> ids){
//stuff
System.out.println(2)
return objs;
}
Output:
1
2
As far as I can tell, it is retrieving from the DB correctly, so it doesn't seem to be a DB issue. Other database calls work fine.
From the debugger, it seems to be hanging somewhere inside the return statement. Specifically, it seems to be hung on SocketInputStream.java while trying to call socketRead0
EDIT: The problem was to do with sorting. I sorted the child objects of the retrieved object. On return, Hibernate was attempting to make additional database calls and hanging as a result. I resolved this by passing the parent object to the calling method and then sorting in the calling method instead of the DAO.