If the entity is new and you haven't flushed, you won't get them as results.
That's by design; queries (SQL, HQL, Criteria) go against the DB, not the
session.
The default FlushMode (auto) avoids this by automatically flushing before
queries, which is ugly but results in the behavior that you're expecting.

   Diego


On Fri, May 21, 2010 at 15:04, jdc <[email protected]> wrote:

> I've got some code like the following:
>
> session.Save(myObject);
> IEnumerable<MyObjectType> objects =
> session.Linq<MyObjectType>().Where(o => o.prop = val);
>
> When I run the query, myObject doesn't show up.  If I look at the
> stats for the session, I see this in the list of entities:
>
>    EntityName: "Fohjin.DDD.EventStore.Records.EventProviderRecord"
>    Identifier: {c0114def-3870-47e6-a399-9d7d00d5b74e}
>    IsBatchLoadable: false
>
> So it IS in the session cache, but not being picked up by the Linq
> query.  If I perform a flush first, then I can get it.  Also, Get will
> grab it as well, though I can't rely on that since my query isn't by
> id.
>
> Is this just a Linq-ism where I have to flush before query, or is
> there some setting I can use to get LinqToNHibernate to see stuff in
> the session cache?
>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

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