On Fri, Aug 10, 2012 at 2:21 PM, Denis Gervalle <dgl(a)softec.lu> wrote:
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 ?
After discussion with Sergiu, we conclude that we should prevent custom
mapping to be cloned when document identity is changed. I have therefore
open/close the following jira issue:
http://jira.xwiki.org/browse/XWIKI-8130
I thought that this will be nice for the future, but it does not fix copies
made in the past that currently prevent successful migration. Sergiu
suggest I should relax my checking in migration to be only a warning. WDYT ?
--
Denis Gervalle
SOFTEC sa - CEO
eGuilde sarl - CTO
--
Denis Gervalle
SOFTEC sa - CEO
eGuilde sarl - CTO