ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clinton Begin" <clinton.be...@gmail.com>
Subject Re: IBATIS 2.3.3, JDK 1.5 - Optimistic locking strategies
Date Tue, 07 Oct 2008 21:53:52 GMT
I'll let others respond to most of your questions, but implementing your own
cache model should be fairly simple...

Implement this interface...


And where you'd normally specify LRU, OSCACHE etc., just use the fully
qualified class name or alias the name (e.g. EHCACHE).


On Tue, Oct 7, 2008 at 3:44 PM, mule_user <sgho@aol.com> 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.

View raw message