On Fri, Aug 10, 2012 at 10:58 PM, Ludovic Dubost <ludovic(a)xwiki.com> wrote:
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
During the migration, this mostly what I do. But if I found a class marked
"internal" mapping, and I do not found the entity in the mapping of
hibernate, I throw an exception that cause the migration to fail.
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.
When a copy of an "internal" custom mapped class is made, it is obvious
that the classname change. Therefore, unless the hibernate mapping has been
updated to anticipate that new class, there is no chance that this copied
class will be properly mapped. And copying XWiki.XWikiPreferences could be
considered common, with really no intend to create a new class.
Currently, I have commit a patch that do not copy custom mapping, never
creating custom mapped class by copy. Since custom mapping is not really a
well known feature and we are even usure we will keep it on the long run, I
think this simple solution is good. Let me know if you really disagree.
My pending question is more about previously copied class, that may trigger
the migration to throw. Is it acceptable to consider that a class custom
mapped "internal" could not be found in the configuration, and that we may
continue proceeding without taking care ?
Ludovic
2012/8/10 Denis Gervalle <dgl(a)softec.lu>lu>:
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
_______________________________________________
devs mailing list
devs(a)xwiki.org
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
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Denis Gervalle
SOFTEC sa - CEO
eGuilde sarl - CTO