Very interested in this, as I am experiencing the exact same issue. On Tue, Aug 17, 2010 at 10:46 PM, Dan Jasek <[email protected]> wrote:
> Yep. I tried to add a flush. No affect. > > Originally I thought this is only for SubSelects, but it looks to be > true for all fetch strategies. > Even Join does not work. The SQL query shows the join, but it doesn't > make it into the object. When an SQL query is sent to standard out, > does it always query the database? Or will it forgo the actual > database hit if it thinks the result is in the first level cache? Or > will it ignore the row from the DB if it can find the object in the > cache? > > I don't know much about the NH internals, but it looks like an issue > with a stale instance of A. If I do a findall of B, it is correct and > the BelongsTo association to A is correctly setup. > > The actual class I am using is a bit more complecated than the example > I described. I will setup a simpler test to better nail down where > the issue is coming from. > > -Dan > > On Aug 17, 1:02 am, Markus Zywitza <[email protected]> wrote: > > Sorry, incomplete mail last time. I was playing with Thunderbird, but > > it doesn't work as expected.... > > > > Am 17.08.2010 00:05, schrieb Dan Jasek:> I have an AR class (lets call > A) with a HasMany relationship where > > > Fetch is set to FetchEnum.SubSelect (called RelB). > > > I have a test which opens up a SessionScope, creates a number of A's, > > > then does a FindAll() for the class. The returned objects have their > > > RelB set to null. > > > If I close the session, then call the FindAll, RelB has the expected > > > list. > > > > This is a flushing problem. Please try to add a > > SessionScope.Current.Flush(); before querying the objects. > > > > Did you configure AR to flush automatically? If yes, do you have the > > same behaviour without FetchEnum.SubSelect? In this case, NH seems to > > miss noticing that a query on A requires a flush if dirty Bs are in the > > session. > > > > -Markus > > -- > You received this message because you are subscribed to the Google Groups > "Castle Project Users" group. > To post to this group, send email to [email protected] > . > To unsubscribe from this group, send email to > [email protected]<castle-project-users%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/castle-project-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Castle Project Users" 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/castle-project-users?hl=en.
