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 Rick <ri...@gmail.com> on 2009/08/23 22:23:06 UTC

confusing on caching prepared statements with datasource and openSession?

I thought that most datasources allow you to cache preparedStatements
at the datasource level, so I'm confused what affect using
sqlSessionFactory.openSession(ExecutorType.REUSE) would be if you
have, or don't have, your datasource set to cache pstmts and you call
(and not call) openSession with ExecutorType.REUSE ?

-- 
Rick R

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


Re: confusing on caching prepared statements with datasource and openSession?

Posted by Clinton Begin <cl...@gmail.com>.
Yeah, if the datasource itself is capable of doing it, then I recommend
going with that approach.  Beware of underlying drivers that don't support
it though.

Cheers,
Clinton

On Sun, Aug 23, 2009 at 2:46 PM, Rick <ri...@gmail.com> wrote:

> So just for my own understanding... If I configured a datasource that
> uses pstmt caching (which for example c3p0 can do on a per-connection
> basis, which isn't a standard implementation I know), can I just not
> even bother opening a Session in iBATIS with ExecutorType.REUSE and
> I'd still get caching implemented by the underlying datasource? Sounds
> like I'm best not even worrying about it and just use openSession().
>
>
> On Sun, Aug 23, 2009 at 4:32 PM, Clinton Begin<cl...@gmail.com>
> wrote:
> > iBATIS only caches at the connection level anyway.  The broad support for
> > this is lacking, so I just avoided the problem.
> >
> > 99% of the gain with psmt caching is in loops in a single thread
> anyway....
> >
> > Clinton
> >
> > On Sun, Aug 23, 2009 at 2:23 PM, Rick <ri...@gmail.com> wrote:
> >>
> >> I thought that most datasources allow you to cache preparedStatements
> >> at the datasource level, so I'm confused what affect using
> >> sqlSessionFactory.openSession(ExecutorType.REUSE) would be if you
> >> have, or don't have, your datasource set to cache pstmts and you call
> >> (and not call) openSession with ExecutorType.REUSE ?
> >>
> >> --
> >> Rick R
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
> >>
> >
> >
>
>
>
> --
> Rick R
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

Re: confusing on caching prepared statements with datasource and openSession?

Posted by Rick <ri...@gmail.com>.
So just for my own understanding... If I configured a datasource that
uses pstmt caching (which for example c3p0 can do on a per-connection
basis, which isn't a standard implementation I know), can I just not
even bother opening a Session in iBATIS with ExecutorType.REUSE and
I'd still get caching implemented by the underlying datasource? Sounds
like I'm best not even worrying about it and just use openSession().


On Sun, Aug 23, 2009 at 4:32 PM, Clinton Begin<cl...@gmail.com> wrote:
> iBATIS only caches at the connection level anyway.  The broad support for
> this is lacking, so I just avoided the problem.
>
> 99% of the gain with psmt caching is in loops in a single thread anyway....
>
> Clinton
>
> On Sun, Aug 23, 2009 at 2:23 PM, Rick <ri...@gmail.com> wrote:
>>
>> I thought that most datasources allow you to cache preparedStatements
>> at the datasource level, so I'm confused what affect using
>> sqlSessionFactory.openSession(ExecutorType.REUSE) would be if you
>> have, or don't have, your datasource set to cache pstmts and you call
>> (and not call) openSession with ExecutorType.REUSE ?
>>
>> --
>> Rick R
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>
>



-- 
Rick R

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


Re: confusing on caching prepared statements with datasource and openSession?

Posted by Clinton Begin <cl...@gmail.com>.
iBATIS only caches at the connection level anyway.  The broad support for
this is lacking, so I just avoided the problem.

99% of the gain with psmt caching is in loops in a single thread anyway....

Clinton

On Sun, Aug 23, 2009 at 2:23 PM, Rick <ri...@gmail.com> wrote:

> I thought that most datasources allow you to cache preparedStatements
> at the datasource level, so I'm confused what affect using
> sqlSessionFactory.openSession(ExecutorType.REUSE) would be if you
> have, or don't have, your datasource set to cache pstmts and you call
> (and not call) openSession with ExecutorType.REUSE ?
>
> --
> Rick R
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>