The primary reason I've applied this FlushMode is because I've incorporated
the CpBT model. There are a number of places where it is mentioned that
this works with the FlushMode.Never setting, e.g.
http://fabiomaulo.blogspot.nl/2008/12/identity-never-ending-story.html.
And, of course, the uNhAddIns applies this in its implementation in
https://code.google.com/p/unhaddins/source/browse/uNhAddIns/uNhAddIns/SessionEasier/Conversations/NhConversation.cs
 with:

private static void EnsureFlushMode(ISession session)
{
if (session.FlushMode != FlushMode.Never)
{
log.Debug("Disabling automatic flushing of the Session");
session.FlushMode = FlushMode.Never;
}
}


On Thu, Sep 12, 2013 at 12:22 PM, pvginkel <[email protected]> wrote:

> We're building a large application with NHibernate as ORM layer. We've
> tried to apply as many best practices as possible, among which setting
> FlushMode to Never. However, this is giving us pain, for example the
> following scenario:
>
> There is a table with an end date column. From this table, we delete the
> last (by end date) record:
>
>
>    - The record is deleted;
>    - After the delete, we do a (repository) query for the last record (by
>    end date);
>    - This last record is updated because it's the new active record.
>
> This is a very simple scenario, of which many exist. The problem here is
> that when we do the query, we get the deleted record back, which of course
> is not correct. This roughly means that we cannot do queries in business
> logic that may touch the entity being inserted or deleted, because its
> resp. not there yet or still there.
>
> How can I work with this scenario? Are there ways to work around this
> without reverting the FlushModesetting or should I just give up on the
> FlushMode setting all together?
>
> (this is a cross-post from
> http://stackoverflow.com/questions/18761613/problems-with-nhibernate-flushmode-never
> )
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "nhusers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/nhusers/aNQm94ffkrk/unsubscribe.
> To unsubscribe from this group and all its topics, 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/groups/opt_out.
>

-- 
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/groups/opt_out.

Reply via email to