It actually depends: using FlushMode.Always, if we issue a query, 
NHibernate will first flush, IIRC.

RP


On Thursday, February 5, 2015 at 11:31:39 AM UTC, Gunnar Liljas wrote:
>
> No, the answer is still "yes", If you query for the entities without 
> something that triggers a flush, they will still be returned.
>
> Be careful when working with separate threads. It can work, but it's not 
> designed for that.
>
> /G
>
> 2015-02-04 23:35 GMT+01:00 sturdytree <[email protected] 
> <javascript:>>:
>
>> Thanks Gunnar, in fact the reason I was getting the entity returned was a 
>> race condition (my program being multi threaded), where in fact 
>> Session.Query was being called *before* Delete was being called.
>>
>> I believe the answer to the question is 'no' - Delete (without a flush) 
>> ensures subsequent calls to the Session do not return the entity - I 
>> imagine this is because Delete updates in memory Session only, and Flush 
>> synchronises Session with the database.
>>
>> You can try a small test yourself to show this is the case.
>>
>>
>> On Wednesday, February 4, 2015 at 10:15:08 PM UTC, Gunnar Liljas wrote:
>>>
>>> Yes, it is expected. Use Flushmode.Commit or call session.flush 
>>> manually. 
>>>
>>> /g
>>>  
>>> —
>>> Sent from Mailbox <https://www.dropbox.com/mailbox> 
>>>
>>>
>>> On Wed, Feb 4, 2015 at 9:45 PM, sturdytree <[email protected]> 
>>> wrote:
>>>
>>>>  
>>>> If I have the following, with a FlushMode of Never:
>>>>
>>>> using (ITransaction txn = Session.BeginTransaction)
>>>> {
>>>> Session.Delete(entity);
>>>> txn.Commit
>>>> }
>>>>  
>>>> is it expected behaviour that subsequently calling Session.Query<T> to 
>>>> load all entities will include the above entity, where Flush is called 
>>>> after Session.Query?
>>>>
>>>> The reason I call Flush later is that I run Session on a separate 
>>>> thread so database calls take place behind the scenses and don't slow the 
>>>> application.
>>>>
>>>>
>>>>  -- 
>>>> 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.
>>>>
>>>
>>>  -- 
>> 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