Here is my attempt to fix the issue: https://github.com/openwide-java/hibernate-search/commit/8ddad809c82b6b21817dcdc5bb3cc262dbe8f855 using the idea of Yoann.
Ok. I added some comments. The change looks simple enough, but is of course also a bit sneaky. It creates role names which actually do not exist. However, since I cannot have the same property name more than once in the hierarchy it should just work. I guess this approach is easier to understand and maintain than a regexp, so let's go for this.
If you're OK with it, I can push a PR.
+1 If you can please use my test classes. Basically the same, but I refactored the test a bit and in particular let it extend SearchTestCaseJUnit4.
To illustrate the problem I have with your patch, consider the following pseudo code: ...
You counter example is correct. A conflict like this in the package name would atm fail. I guess one could tweak the regexp a bit, but it only gets more complicated. On the other hand, I think this case would be extremely rare, but anyways.
I still like the idea. If there were a deterministic way to split off the class name, I think I would prefer the regexp (it would also be a much easier one). I guess ORM 5 will introduce a new naming pattern, but that's not what we are aligned with for now.
|