ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm jee <tm_...@yahoo.co.uk>
Subject iBatis session
Date Sat, 05 Aug 2006 09:58:06 GMT
Hi guys, 

With the following code,

sqlMapClient.queryForList(....);  // 1
sqlMapClient.queryForList(....);  // 2

Will (1) and (2) be executed in the same session or in a seprate session. In the Javadoc of
SqlMapClient's openSession() it says that
"Remember though, that SqlMapClient itself is a thread safe SqlMapSession  implementation,
so you can also just work directly with it"

Is it that sqlMapClient is a session itself (thread-safe) such that when executing "queryForList",
its done in the same session?

With the following, 
SqlMapSession session1 = sqlMapClient.openSession();
session1.queryForList(...); // 1a
session1.queryForList(...); // 1b

SqlMapSession session1 = sqlMapClient.openSession();
session2.queryForList(...); //2a
session2.queryForList(...); //2b

Is it correct to say that if a cacheModel is defined for all the queryForList statement, 1a
and 1b will uses the same cache as they are from the same session while 2a and 2b will be
using the same cache as they are from the same session?

If sqlMapClient is a session itself, is it correct to say that all the statement executed
within sqlMapClient itself will be using the same cache if one is defined?



View raw message