ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <simone.trip...@gmail.com>
Subject [ibatis3] Throubles on caching pt2
Date Wed, 09 Dec 2009 07:47:30 GMT
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


Mime
View raw message