If we want to fix the issue fully, we would need either: 1/ To read the hbm file to list the custom mapped classes and then apply custom mapping whenever the class is in the list 2/ To list the custom mapped classes in the configuration and do the same thing As for a copy of XWikiPreferences, I'm not sure why the custom mapping is not applied. Is the class of the object changing to another class name ? Because if it's not the custom mapping should work. Ludovic 2012/8/10 Denis Gervalle <[email protected]>:
On Fri, Aug 10, 2012 at 2:21 PM, Denis Gervalle <[email protected]> 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 _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Ludovic Dubost Founder and CEO Blog: http://blog.ludovic.org/ XWiki: http://www.xwiki.com Skype: ldubost GTalk: ldubost