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: [ibatis3] Throubles on caching pt2
Date Thu, 10 Dec 2009 13:34:47 GMT
Hmmm...

I had thought we fixed that.  Just in case, file a jira ticket and
I'll have a look.

I believe the intended behavior is that it should always cache, unless
rollback is called.

Clinton

On 2009-12-09, Simone Tripodi <simone.tripodi@gmail.com> wrote:
> Hi all guys,
> I've been porting my old stuff to the version 3 and I noticed queries
> are stored only and only if I force the session commit.
> I didn't understand if this is the right way to proceed or maybe I
> miss something, can anyone please give me a more detailed
> explaination?
> This morning I switched to the beta-6 release, and the behavior is the same.
>
> Just to give you a more concrete idea:
>
> In this case, the query won't stored
>
> SqlSession session = this.sqlSessionFactory.openSession();
>         try {
>             ContactMapper mapper = session.getMapper(ContactMapper.class);
>             Contact ret = mapper.getById(id);
>             return ret;
>         } finally {
>             session.close();
>         }
>
> In this case neither:
>
> SqlSession session = this.sqlSessionFactory.openSession(true); //
> <----- Enable the auto-commit
>         try {
>             ContactMapper mapper = session.getMapper(ContactMapper.class);
>             Contact ret = mapper.getById(id);
>             return ret;
>         } finally {
>             session.close();
>         }
>
> In this last case, works:
>
> SqlSession session = this.sqlSessionFactory.openSession();
>         try {
>             ContactMapper mapper = session.getMapper(ContactMapper.class);
>             Contact ret = mapper.getById(id);
>             session.commit(true);
>             return ret;
>         } finally {
>             session.close();
>         }
>
> Many thanks in advance, best regards,
> SImone
>
> --
> http://www.google.com/profiles/simone.tripodi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

-- 
Sent from my mobile device

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message