EvictVisitor fix for non session associated collections

Description

Hello,

Could you please apply a change to NHibernate.Event.Default.EvictVisitor class
method private void EvictCollection(IPersistentCollection collection)

and change line:
if (ce.LoadedPersister != null && ce.LoadedKey != null)
to
if (ce != null && ce.LoadedPersister != null && ce.LoadedKey != null)

Issue:
I have an object "A" whitch was reassociated with session. This object has a collection. When I trying to Evict object "A" from session I'm getting exception "Object is not set..." because collection is not reassociated with the session (I'm not sure if it is possible, because Lock method only allows proxy entities).

Thanks in advance,
Geddis

Environment

None

Activity

Show:

Fabio Maulo May 17, 2011 at 4:11 PM

2 years waiting to know the mapped cascade are enough.

Fabio Maulo July 9, 2009 at 8:23 AM

With know which is the method used to re-associate the entity to a new session and without know which is the cascade used in the mapping this patch does not have sense.
Applying it may mean obscure a wrong mapping.

Fabio Maulo June 19, 2009 at 8:31 PM

I'm sorry. We can't apply a patch without a failing test.

Incomplete

Details

Assignee

Reporter

Components

Priority

Who's Looking?

Open Who's Looking?
Created June 19, 2009 at 2:35 AM
Updated May 17, 2011 at 4:11 PM
Resolved May 17, 2011 at 4:11 PM
Who's Looking?