Hi Gustavo,

Ok. Thanks.
I'll wrap things in a transaction.

Cheers.
2009/7/27 Gustavo Ringel <[email protected]>

> Since NH 2.0.1 there is no automatic flush, so you should commit a
> transaction or use flush never and flush by your self. During save or
> update you are getting because you may be using a strategy like identity
> which needs a flush to get the ID, but this is more an inevitable problem
> than a feature.
>
> Gustavo.
>
>
> On Mon, Jul 27, 2009 at 7:39 AM, Dmitiry Nagirnyak <[email protected]>wrote:
>
>> Hi,
>>
>> Call Session.Delete(object) never executes the DELETE SQL.
>> If I wrap it in a transaction - it does.
>>
>> Additionally when I use Session.SaveOrUpdate(object) I don't need to wrap
>> it in transaction or Flush. It does execute the SQL.
>>
>> Feels very inconsistent. Do I miss something?
>>
>> I do not provide any additional settings in config (FNH), so just all the
>> defualts are used.
>>
>> Code 1:
>> var p = WorkSpace.Get<Product>(id);
>> WorkSpace.Delete(p);
>>
>> Code 2:
>> var p = new Product { Name = "asd" };
>> WorkSpace.SaveOrUpdate(p);
>>
>>
>> As far as I know NH now uses implicit transaction, so it's not mandatory
>> to wrap code in transactions.
>>
>>
>> My main question is WHY Delete does NOT execute SQL DELETE and
>> SaveOrUpdate DOES?
>>
>> Should I Flush session after every operation?
>>
>> Thanks,
>> Dmitriy.
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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