Picking on what Gunnar said, sessions are meant to be short lived; that is, 
you open one when you need to query the database or save something, and 
then you close it, together with any transaction that it may use. Don't 
worry, sessions in NHibernate are lightweight. Keeping a transaction open 
for potentially so long is not recommended, regardless of NHibernate.
Another possible alternative to transactions (not sure if it is applicable 
in your case) is to use optimistic concurrency control. This way you can be 
certain that if someone changes a record that you are updating you will be 
notified of it.

RP

On Monday, October 20, 2014 11:21:18 PM UTC+1, Gunnar Liljas wrote:
>
> Keeping a session open for that long is extremely highly not recommended. 
> I suggest fixing that before attacking other, potentially resulting, 
> problems.
>
> /G 
>
> 2014-10-20 17:19 GMT+02:00 johnstrez77 <[email protected] <javascript:>>:
>
>> I'm hoping someone can point me in the right direction. I'm working with 
>> an asp.net eCommerce cart platform that uses nhibernate for persistence. 
>> This cart starts up a session on application start and it remains open 
>> until application end. I am trying to do some batch processing on the site, 
>> and I'm able to open a stateless session and run the code, but I'm noticing 
>> it locks the database( i.e. the site hangs, can't execute another query on 
>> the sql server database) until the stateless batch process finishes. Does 
>> anyone know why this is happening?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "nhusers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/nhusers.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to