dvi2006 wrote:
What is the best way to handle session in a long activity?
I have a scheduled application that need to read many entities (> 30000) and for each entity execute a quite complex calculation (reading children entities, updating data, ...).
Creating a single Session and Transaction seems to be too heavy (I think because the cache grows too much).
It is better to create a session/transaction for each entity?
Or maybe clearing and flushing the cache for each entity?
Thanks
Davide
Hello...
Is there the option of moving this calculation into the Database? You could create a SP that will perform these operations and call it directly.This will allow you to skip NHiibernate completely and do the batch updates directly on the db. (Or scedule a job which will do the updates)