NHibernate version: 1.0.2
Not sure if anyone can answer this one since it's a little obscure, but here goes:
I'm using the ILifecycle interface to implement logical deletion and in that method I'm executing the following query to check whether the current entity (ProcessingModule) is being used in any other ProcessingModuleInstances.
Code:
SELECT
COUNT(i)
FROM
ProcessingModuleInstance i
WHERE
i.ProcessingModule.id = :Id
If there are no matches then the ProcessingModule.Deleted property is set to true and the deletion is Vetoed. If the query returns anything other than 0 I throw my own exception indicating that the ProcessingModule is referenced.
The problem is that I'm getting another exception "Found two representations of same collection:" (with nothing after the colon) when trying to commit.
If the above query is not run in the ILifecycle.OnDelete method then the unexpected exception does not occur - which seems odd since the above query doesn't actually load any collections.
So, why am I seeing this strange exception - any ideas out there?
Symon.