Hi devs,
Following upon an issue with migration encountered by Jeremie Bousquet, I
felt on an unexpected issue that I do not really know how to fix.
When you made a copy of a document containing a custom mapped class, a new
custom mapped class is created by the exact copy of the original document
class definition, but the custom mapping for this copied class is probably
incorrect or not available.
For exemple, if you made a copy of XWiki.XWikiPreferences, you get a new
class that has an internal mapping, but since the .xbm is unchanged, there
is probably no chance that the newly defined class has a mapped entity in
the hibernate mapping. This is precisely the cause of the issue I have
encounter with Jeremie, since the migration tried to migrate IDs of that
new class, which was unusable. Initially, I had an NPE that I have
transformed into an exception now, since I see this as a corruption
somewhere in the store.
The issue with a dynamically custom mapped class could even be worse, since
both class will have the same mapping.
So my question is more generally about how we handle copy of custom mapped
classes ? now and in the future ?
--
Denis Gervalle
SOFTEC sa - CEO
eGuilde sarl - CTO