Affects Version/s: 1.9.1 (Evans SR1)
This behaviour was incorrectly reported reopening
DATACMNS-590 by me, sorry about that
After the resolution of
DATACMNS-590, we found another strange behaviour using Spring Data MongoDB, but only disabling the default type mapper resolution, which resolves the class type to map using an attribute. See github repo and run unit tests.
I simplify a lot the domain model and use the generics in the minimal expression as possible to reproduce this, and I think now is much easier to understand.
Take a close look at:
Retrieving a Customer and navigate to ItemType will lead to a ClassCastException due the lost of generic type. But if we retrieve an Item and navigate to ItemType is ok.
I know this is a corner case, and as said in
DATACMNS-590 this will probably lead into a 'work-as-designed' resolution.
We can't use the default type, because we are not using Spring to populate the database, but we think we can workaround this providing a custom type mapper.