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: Potential connection problem when using managed transactions in iBATIS 3
Date Tue, 10 Nov 2009 15:26:22 GMT
That is a little odd.  It looks like I intended for something else there.
I'll look at it.

Clinton

On Tue, Nov 10, 2009 at 8:09 AM, Poitras Christian <
Christian.Poitras@ircm.qc.ca> wrote:

>  What is the expected behaviour when calling dataSouce.getConnection() for
> managed transactions in iBATIS 3?
>
> I find suspicious that ResultLoader calls dataSouce.getConnection() at line
> 89 which could create an unexpected connection. And since managed
> transaction is used, the connection may never be closed.
>
>
> Christian
>
>
> Here is the code from ResultLoader which calls dataSouce.getConnection() :
>
> *private* Executor newExecutor() *throws* SQLException {
>
> Environment environment =
> configuration.getEnvironment();
>
> *if* (environment == *null*)
>
> *throw* *new* ExecutorException("ResultLoader could not load lazily.
> Environment was not configured.");
>
> TransactionFactory txFactory = environment.getTransactionFactory();
>
> *if* (txFactory == *null*)
>
> *throw* *new* ExecutorException("ResultLoader could not load lazily.
> Transaction Factory was not configured.");
>
> DataSource ds = environment.getDataSource();
>
> *if* (ds == *null*) *throw* *new* ExecutorException("ResultLoader could
> not load lazily. DataSource was not configured.");
>
> Connection conn = ds.getConnection();
>
> conn = wrapConnection(conn);
>
> Transaction tx = txFactory.newTransaction(conn,
> *false*);
>
> *return* configuration.newExecutor(tx, ExecutorType.*SIMPLE*);
>
> }
>

Mime
View raw message