I have a few questions regarding iBatis cacheModel. All help is greatly appreciated.
 
1) When the iBatis cacheModel is used, a connection to the database server appears to be still required. The data has been cached, so I'm not sure why the database server needs to be up after caching the data.
 
For exapmle, I have test code that basically returns the same row of data n times. As expected, the data is cached and remains unchanged desipte making updates using the database command line client (i.e. outside of my program). During the ith (1<i<=n) try, I shutdown the database server. I would expect iBatis to just use the cache results and not require the database server to be up. However, instead I get the following error when I bring the database server down:
 

Exception in thread "main" org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException

MESSAGE: java.net.ConnectException: Connection refused: connect

 
I would like to have mechanism that allows the application to use cached data in the event the database server is down as it does when the database server is up. Is the cachModel capable of providing this functionality? Why does the database server need to be up when iBatis is using cached results?
 
2) By specifying the flushOnExecute, iBatis will flush the cache when a certian statement(s) is executed. Is there a way for iBatis to flush the cache when anything (i.e. another application) makes an update, insert or delete?
 

Reply via email to