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: using java SortedSet instead of List for the resultMap
Date Thu, 04 Sep 2008 16:13:37 GMT
1.  Right.

2.  iBATIS caching can be globally distributed, at the app level, or at the
session level.   It's just really hard to configure!   :-)

Here's a simple breakdown

For a local/session scoped read/write cache, use: serializable=false,
readOnly=false
For a shared read-only cache, use: serializable=false, readOnly=true
For a shared read/write cache, use: serializable=true, readOnly=false

In this context, read/write refers to whether you expect anyone to actually
modify the cached instance of the object... thus tainting them if you
weren't careful to clone them.

I usually suggest using read-only caches and specifically retrieving
non-cached instances for updates.  In a nutshell, cache lists, don't cache
individual objects, flush on update.

For globally distributed caches, use OSCache or your own adapter for
EHCache, JBossCache or Coherence and depending on their implementation, the
rules above may change.

Clinton

On Thu, Sep 4, 2008 at 9:37 AM, zeppelin <shantanu.u@gmail.com> wrote:
>
> Thanks for that. I had previously read about RowHandler. Tell me if these
are
> correct :
>
> 1. Using the RowHandler, I would have to handle the cache myself and not
> rely on iBATIS. Therefore, the 'cacheModel' attribute will be ignored. But
> what I really wanted to use was the flushing mechanism.
>
> 2. Technically the caching in iBATIS is at application level. It is
> described to be at session level since we can chage the way a user session
> received an object -  a cloned object or a reference to the same object.
>
> Just wanted to cofirm these. Also, it's a little strange that stored proc
> out params cannot be cached.
> Thanks again.
> Zeppelin
>
>
> Clinton Begin wrote:
> >
> > You can pass in a RowHandler and have the results collect in whatever
sort
> > of collection you like.  The default implementation itself is a
> > rowhandler,
> > something (not exactly) like this:
> >
> > public class ListRowHandler implements RowHandler {
> >   private List list = new ArrayList();
> >
> >   public void handleRow(Object valueObject) {
> >     list.add(valueObject);
> >   }
> >
> >   public List getList() {
> >     return list;
> >   }
> > }
> >
> > Clinton
> >
> > On Thu, Sep 4, 2008 at 8:41 AM, zeppelin <shantanu.u@gmail.com> wrote:
> >
> >>
> >> I have seen a similar question on this forum but it's not answered.
> >>
> >> My scenario :
> >> * I'd like to use the iBATIS cache. It's working fine.
> >> * My requirement is to use TreeSet cos I specifically want to use the
> >> subset(...) method.
> >>
> >> It appears there's just no way in iBATIS to return a Set instead of a
> >> List.
> >> I can't understand why this feature is absent.
> >>
> >> Using the present approach, I have to pass the list to the TreeSet and
> >> then
> >> use it. This has to be done for ever user session that wants to access
> >> the
> >> cached entity.
> >>
> >> Is there any work around ? Is this supported in the spring framework ?
> >> I'm
> >> using org.springframework.orm.ibatis.support.SqlMapClientDaoSupport .
> >>
> >> regards
> >>
> >> Zeppelin
> >> --
> >> View this message in context:
> >>
http://www.nabble.com/using-java-SortedSet-instead-of-List-for-the-resultMap-tp19310126p19310126.html
> >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
http://www.nabble.com/using-java-SortedSet-instead-of-List-for-the-resultMap-tp19310126p19313314.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>

Mime
View raw message