Support indexing of entities using an @IdClass for composite keys
Description
duplicates
Activity

Yoann Rodière October 7, 2020 at 8:24 AM
Closing this ticket: we started addressing the issue in HSEARCH-4025. Mass indexing still doesn't work though; this will be addressed in HSEARCH-4033.

Sanne Grinovero March 16, 2016 at 10:30 PM
Hi Giovanni,
the general problem is that the indexing system requires a single term to unequivocally identify the entity.
So if in the database your composite id is made of two strings (for example), you need to be able to provide a bridge which transforms the pair into a keyword; Unfortunately not knowing what you might store in strings it is not safe for Hibernate Search to do this mapping automatically.
The @DocumentId
strategy should work, could you describe your error, or even better provide a full example?

Giovanni Lovato March 16, 2016 at 11:31 AM
Any feedback/workaround for this issue? I'm hitting it and I can't switch to EmbeddedId
, and @DocumentId
on a getter throws:
Details
Assignee
Yoann RodièreYoann RodièreReporter
Sanne GrinoveroSanne GrinoveroComponents
Priority
Major
Details
Details
Assignee

Reporter

Apparently we have no mapping solution for composite key cases as described at:
https://forum.hibernate.org/viewtopic.php?f=9&t=1024512
I think that's a major use case and we should definitely provide a solution.
I'm pretty sure that I did such mappings in the past and don't remember what kind of workaround I might have used - that was a long time ago and it might not be possible anymore - or if it is, we should document the strategy.