*or when a query is executed (to make sure the query results reflect the
in-memory changes).*

Partially correct, the consept QuerySpaces comes in to play. If a query
wants items from EntityA and queries the property of type EntityB then only
if there are instances of EntityA and EntityB in the dirty list, then flush
will occur

On Mon, Oct 27, 2008 at 8:34 PM, Symon Rottem <[EMAIL PROTECTED]> wrote:

> Newly persistent and modified entities are flushed depending on the
> FlushMode that's set - the default is to flush on commit or when a query is
> executed (to make sure the query results reflect the in-memory changes).
>
> If you were using database assigned identifiers the newly persistent
> objects would be flushed to the DB as soon as they're saved to get their
> Ids.
>
> Cheers,
>
> Symon.
>
> On Mon, Oct 27, 2008 at 7:12 PM, Berke <[EMAIL PROTECTED]> wrote:
>
>>
>> I'm know this is a very basic question and for that I applogize but I
>> am missing something fundamental here. I am using an open session in
>> view model, and I close the session in the EndRequest event of an
>> httpmodule.
>>
>> I just noticed that when I called SaveOrUpdate on my root object that
>> is was not actually saved to the DB until I closed the session. I
>> would like for the object to be persisted when I call into nHibernate
>> allowing me to handle failures gracefuly.
>>
>> I am using the following snippet to map this object:
>>
>>        <class name="xxx.Organization" table="Organization" lazy="false">
>>                <id name="Id" column="OrganizationId">
>>                        <generator class="guid" />
>>                </id>
>>                <property name="Name" column="Name" type="String"
>> length="50"/>
>>
>> .... other properties removed, I do have Components, an IdBag and a
>> Set in addition to regular properties.
>> </class>
>>
>> I guess my workaround is to force a flush after I call SaveOrUpdate
>> but what is the recommended practice? Am I missing something else?
>>
>> Thanks guys,
>> Josh
>>
>>
>>
>
>
> --
> Symon Rottem
> http://blog.symbiotic-development.com
>
>
> >
>


-- 
Tuna Toksöz

Typos included to enhance the readers attention!

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