I was under the impression that the transaction per HTTP request was more for 
easy error handling than performance.  If some SQL halfway through the request 
bombs out you automatically roll everything back.

Anyway, iBATIS has nothing like this built in, but you could set something 
similar up with declarative transactional support in Spring.  If you're using 
the Spring web framework with the DispatcherServlet and stuff I think it'd be 
pretty easy to specify the transactions wherever you wanted.  Personally, I 
like to stuff my transaction handling as far 'down' as possible, but I guess 
there's no reason you couldn't bring it 'up' as far as you want.

Also, I believe if you do it right, changing transactional behavior won't 
require refactoring because the transactional support should be transparent to 
your code.  I like to write my business logic as clearly as possible, then 
figure out what's transactional, and then specify the transactions outside the 
code using Spring.  That's just my opinion, I know some folks really like 
writing explicit transaction handling in their code, but I find it makes things 
overly complicated and I can do everything I need at the method level.

PS: I sound like a Spring salesman today!  Buy now and I'll throw in a set of 
steak knives for free!

Cheers,
Chris

-----Original Message-----
From: Andreas Prudzilko [mailto:[EMAIL PROTECTED]
Sent: Sat 12/16/2006 1:39 PM
To: user-java@ibatis.apache.org
Subject: Re: Connection session bound
 
Yeah I agree, it was more about choosing the best practice. From my 
experience it saves a lot of refactoring if you do it right in the first 
place :-D
I guess I leave it for now as is, and see what happens in production.

Thanks,

- Andreas
> If you are using a pool, it would give almost no benefit, IMO.
>
> Try it simple, if you have problems, optimize them later - premature
> optimization is the root of many evils. ;-)
>
> Larry
>
>
> On 12/16/06, Andreas Prudzilko <[EMAIL PROTECTED]> wrote:
>>
>>  Hi Brandon,
>>
>>  well i was just reading some hibernate tutorials and there were some
>> thought about binding a db connection at least to a http request to gain
>> more performance.
>>  Now im writing an ajax webapplication, so i have a lot of tiny http
>> requests. So binding the db connection there wouldn't make much 
>> sense. So I
>> thought, if its beneficial I would prefer binding it to a http sessions.
>>  Well might be of course total bogus :-D. To be honest I'm not even 
>> sure how
>> the performance would improve especially since there is a connection 
>> pooling
>> to begin with.
>>
>>  Any remarks on my thoughts?
>>
>>  - Andreas
>>
>>
>> I can't imagine a situation where I would tie a connection to an
>> HttpSession. What is causing you to consider this? If you can provide 
>> some
>> insight as to why you would want to do this we can provide more pointed
>> advice.
>>
>>  Brandon
>>
>>
>> On 12/16/06, Andreas Prudzilko <[EMAIL PROTECTED]> wrote:
>> > Hi,
>> >
>> > i was wondering about the connection pooling in ibatis. Is it possible
>> > to bind a connection to a httpsession?
>> > Or are there any pros and cons to do it?
>> >
>> > - Andreas
>> >
>> >
>> >
>>
>>
>>
>


Reply via email to