Hello,
can anybody confirm wheter the following is a bug or misuse?
We map a legacy DB with composite keys. Each entity with composite
keys maps to a key type that represents the structure of that key.
When loading data we get an exception from
NHibernate.Property.BasicGetter.Get().
Part of the stack trace:
NHibernate.DLL!NHibernate.Property.BasicGetter.Get(object target =
"TGLH") Line 49
NHibernate.DLL!NHibernate.Type.ComponentType.Equals(object x = {4000/
R 24K}, object y = "TGLH") Line 147
NHibernate.DLL!NHibernate.Impl.CollectionKey.Equals(object obj =
{NHibernate.Impl.CollectionKey}) Line 36
That's because NHibernate.Impl.CollectionKey.Equals() is called with
an CollectionKey of type String whereas the called CollectionKey has a
keyType of ComponentType. ComponentType.Equals() does not check types
(for unknown reasons).
CollectionKey.Equals() checks both, equality of the underlying
keyTypes and equality of the underlying role - in that order. Checking
the role first does fix the problem in our case: Exchange
> return keyType.Equals(key, that.key) && Equals(role, that.role);
by
> return Equals(role, that.role) && keyType.Equals(key, that.key);
Thank you for any comments.
-Chris