Hi, our project uses ibatis in a slightly different way. The legacy system uses a ConnectionManager to obtain and release connections. So I had to use SqlMapClient.openSession(Connection).
Accordiing to the javadoc, when using openSession(Connection), I need to manage transaction myself, which I did. IBatis works fine with queryForObject and queryForList. The problem occurs when I have a 1+N mapping (where a select statement is specified to get a sub-object) in the mapping file. In this case, a NullPointerException is thrown at line 780 of SqlMapExecutorDelegate class, which calls txManager.end(session). The stack trace also shows that this error occurs when iBatis is trying to call queryForList() when the lazily loaded list is evaluated. This leads me to suspect that iBatis knows not to do transaction when the java code calls queryForList, but when it performs a 1+N mapping, it fails to ignore transaction, hence caused NPE. This is just my wild guess based on the symptom. Currently we delete the 1+N mapping from the mapping file and do it with a Java loop. It works fine. -- View this message in context: http://www.nabble.com/NPE-when-using-user-connection-and-sub-select-statement-tf2931416.html#a8195657 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
