I'll let others respond to most of your questions, but implementing your own cache model should be fairly simple...
Implement this interface... http://svn.apache.org/repos/asf/ibatis/trunk/java/ibatis-2/ibatis-2-core/src/com/ibatis/sqlmap/engine/cache/CacheController.java And where you'd normally specify LRU, OSCACHE etc., just use the fully qualified class name or alias the name (e.g. EHCACHE). Clinton On Tue, Oct 7, 2008 at 3:44 PM, mule_user <[EMAIL PROTECTED]> wrote: > > I would like to explore the strategies for achieving optimistic locking > using > iBATIS 2.3.3 and JDK 1.5. > > Following are the constraints: > 1. Need to use timestamp column in the database. Cannot use version column > in the database, as the current data model does not support version. > 2. It will be possible to achieve optimistic locking using timestamp, if I > keep "OldObject" in scope and write SQL similar to: > > update TABLE1 > set COL1 = 'valueFromNewObject' > where ID = idOfOldObject > and timestamp = timestampOfOldObject; > > This approach requires keeping "OldObject" in scope. "OldObject" may be > available either in program scope, or can be looked up from cache. > > That being said, I would like to ask the following questions: > > 1. Will it be possible to use cache model of iBatis to keep "OldObject" in > scope? In that way, me as an application developer will not have to write > any code. Caching in iBatis looks like: > > <cacheModel id="product-cache" implementation="LRU"> > > If iBatis cache can be used to keep "OldObject" in scope, please show > example on how I can look up the "OldObject" from the cache model of > iBatis. > > 2. Please show how I can extend the cacheModel of iBatis to use other cache > e.g. ehcache. > > 3. Is it a good idea to extend the cache model of iBatis to ehcache? Or, > should the cache model of iBatis be used for looking up "OldObject"? > > 4. Is there another way to achieve optimistic locking using timestamp, > without looking up the "OldObject" available from the program scope, or > from > the cache? > > 5. Please refer me to any other articles, readings, or example code. > -- > View this message in context: > http://www.nabble.com/IBATIS-2.3.3%2C-JDK-1.5---Optimistic-locking-strategies-tp19867989p19867989.html > Sent from the iBATIS - User - Java mailing list archive at Nabble.com. > >