yes, you should still call commit (rollback) because the session was
opened (began) you will want to explicitly end the transaction (commit/
rollback).
the common web usage scenario is
1. begin request > open session
2. use a transaction filter on Controller Actions to manage the
transaction
    2.1. before action begin transaction
    2.2. after action commit transaction (rollback if an error occurs)
3. within the action (directly or indirectly) make calls to session
4. end request > close/dispose of session

MonoRail, FUBU and MS MVC make this extremely easy. It's possible with
Webforms, but it requires more work.

On Mar 1, 7:25 am, sbohlen <[email protected]> wrote:
> Depends on the setting of FlushMode re: whether you must do it
> explicitly or not, but in general, yes, you need to commit the tx at
> the end of the tx block *somehow* b/c the whole point of that piece
> referenced above is that you don't necessarily know whether your Get()
> has in fact involved a write op behind the scenes.
>
> -Steve B.
>
> On Mar 1, 5:21 am, "jason.hill" <[email protected]> wrote:
>
> > Very interesting...thanks for the link.
>
> > If you just read data with a Get, do you still need to call
> > tx.Commit() at the end?
>
> > On Feb 26, 12:27 am, Jason Meckley <[email protected]> wrote:
>
> > >http://nhprof.com/Learn/Alerts/DoNotUseImplicitTransactions
>
> > > On Feb 25, 2:18 am, "jason.hill" <[email protected]> wrote:
>
> > > > No, our reads are not performed within an explicit transaction, only
> > > > the updates are. Can you point me to documentation that outlines this?
>
> > > > On Feb 24, 1:35 am, Jason Meckley <[email protected]> wrote:
>
> > > > > 2nd level cache is closely tied to transactions. Are your reads
> > > > > executed within a transaction? All CRUD operations in NH must be in
> > > > > transactions.
>
> > > > > On Feb 22, 5:02 pm, "jason.hill" <[email protected]> wrote:
>
> > > > > > Hi,
>
> > > > > > We upgraded from 1.2.1 to 2.1.2 and noticed a major slowdown in the
> > > > > > performance of our application. We are using the second level cache
> > > > > > extensively via the SysCache provider as the bulk of our database
> > > > > > interaction is via reads. Using SQL profiler we noticed that there
> > > > > > were many more hits to the DB after the upgrade which seems to
> > > > > > indicate that the caching is working differently under 2.1.2 and 
> > > > > > that
> > > > > > many of our objects are no longer being cached.
>
> > > > > > Has anyone else noticed this? Are there some changes in 2.1.2 around
> > > > > > caching that we need to be aware of?
>
> > > > > > Thanks,
>
> > > > > > Jason- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to