i'm still having a problem with this and it's driving me insane!!
what I decided to do was query for the parent, then query for the
children using the parent's ID
(something like ..
customer.Children = sess.CreateCriteria<Child>()
.Add(nhc.Expression.Eq("CustomerID",
customer.ID))
.List<Child>();
this has so far worked great (well .. it works -- i wouldn't call it
great)
However, there are a couple customers who, when I query for the
children, return (in my case) 20 entities, but these entities ARE NOT
in the database. NONE of them.
While I can live with a seemingly broken load of the child entities
(which, btw are mapped bidirectionally, inverse on the customer), I
can't live with the other problem. Am I running into problems with the
cache being out of sync with the database (changes made through
database, not application)? or could i simply not have the 2nd level
cache setup/evicting correctly/timely enough? I've restarted the debug
session, killed all IIS instances, restarted the server numerous
times ... and all that leads me to believe the cache is not the
culprit (it's all in-mem afaik) ... but what else could be happening?
any help/insight on/into either of these 2 problems would be greatly
appreciated.
Recently, I did setup 2nd Level Cache using SysCache ... it's the only
thing I can think of that
On May 13, 10:44 am, Joe Brockhaus <[email protected]> wrote:
> oops, when i was redacting that I forgot to change the code ..
>
> using (var session =
> MyDataContext.Current.SessionManager.OpenSession())
> {
> using (var trans = session.BeginTransaction())
> {
> var cust =
> session.CreateCriteria<Customer>()
> .Add(nhc.Expression.Eq(rValue.NameOf(x =>
> x.BillingInstanceID), customerBillingInstanceID))
> .SetFetchMode(rValue.NameOf(x =>
> x.Children), FetchMode.Eager)
> .UniqueResult<Customer>();
>
> // var cust =
> session.Query<Customer>()
> // .Where(x => x.BillingInstanceID ==
> customerBillingInstanceID)
> // .Single();
>
> rValue = cust;
> }
> }
--
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.