[hibernate-dev] [Search] Redefining inheritance mapping, and why to follow same rules as ORM
Emmanuel Bernard
emmanuel at hibernate.org
Thu Aug 21 12:31:46 EDT 2014
On 21 Aug 2014, at 17:26, Sanne Grinovero <sanne at hibernate.org> wrote:
>> In short, not to annotations on interfaces.
>> Neutral on indexing subclasses with the understanding that we are doing
>> it as best effort but that will remain flaky. The ability to index the
>> @IndexedEmbedded actual type instead of the static type seems to have
>> more merit to me.
>
> Right but that's where I'm coming from. If we index the actual type
> and not the one statically linked to from @IndexedEmbedded, wouldn't
> you expect the same behaviour on subclasses respect to @Indexed?
> I'm not pushing for either solution, just trying to reason about what
> should be considered a consistent behaviour: Hibernate Search 3.x and
> 4.x are *consistent* on this, so what I'm wondering now is if we
> should be consistent again with the choices made in this regard, or is
> the relation between the two far fetched?
Rethinking this, I don’t think you need to know the subclasses ahead of time (at least if they are not hosting properties that need to be indexed.
When reaching an unknown class, you can simply look up the hierarchy to find the most specific superclass marked @Indexed and use that document builder to index the specific subclass. That would solve the problem you are trying to address I think.
More information about the hibernate-dev
mailing list