We're having a problem with read-write non-serializable caching, using an external transaction manager (JTA) and JBoss's local-tx datasource. This refers to iBATIS 2.1.7.597 and the docs that shipped with it.
In the pdf Data Mapper Developer Guide, it says that with a read-write cache, caching will only happen within each session. It also is mentioned in the pdf as well as the javadoc for the SqlMapClient that the SqlMapClient is supposed to handle a session per thread automatically. So I assume that I should see caching associated with each thread using a SqlMapClient without needing to explicitly manage the sesssions. However, we see different caching behavior when explicitly using sessions from when we don't: In our test code, we find that the following usage results in only one SQL PreparedStatement being executed (the second apparently does hit the cache): utx.begin(); if (id > 0) { SqlMapSession session1 = sqlMap.openSession(); server = (ServerInfo) session1.queryForObject("ServerInfo.getServer", id); server = (ServerInfo) session1.queryForObject("ServerInfo.getServer", id); session1.close(); } utx.commit(); While the following code shows two SQL PreparedStatements being executed: utx.begin(); if (id > 0) { server = (ServerInfo) sqlMap.queryForObject("ServerInfo.getServer", id); server = (ServerInfo) sqlMap.queryForObject("ServerInfo.getServer", id); } utx.commit(); Are we missing something? Is this a bug, or did we just not understand how the sqlMap's "automatic" session management is supposed to work for us? Thanks, Mattias Bertelsen