You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Simone Tripodi <si...@gmail.com> on 2009/12/09 08:47:30 UTC

[ibatis3] Throubles on caching pt2

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


Re: [ibatis3] Throubles on caching pt2

Posted by Simone Tripodi <si...@gmail.com>.
Hi Clinton,
yes indeed, I found a closed jira issue about that after I sent the
email on ML. How to proceed? Should I reopen the existing issue or
jusr create a new one?
Thanks in advance, best regards,
Simone

On Thu, Dec 10, 2009 at 2:34 PM, Clinton Begin <cl...@gmail.com> wrote:
> 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 <si...@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
>
>



-- 
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


Re: [ibatis3] Throubles on caching pt2

Posted by Clinton Begin <cl...@gmail.com>.
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 <si...@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