Support IdentifierBridge with provided IDs

Description

Currently, when a mapper relies on provided IDs, we expect the IDs to be strings, always.

In infinispan, it's a bit annoying because keys (IDs) can have many types, so Infinispan ends up needing to add some external conversion logic which is quite dirty.

We should provide a way to plug in a custom identifier bridge when provided IDs are enabled, so that the logic is executed internally in Hibernate Search and Inifinispan can simply work on its keys directly.

First, we will have to change the configuration: org.hibernate.search.mapper.pojo.mapping.spi.AbstractPojoMappingInitiator#setImplicitProvidedId(boolean) becomes org.hibernate.search.mapper.pojo.mapping.spi.AbstractPojoMappingInitiator#setProvidedIdentifierBridge(BeanReference<IdentifierBridge<Object>>).

Then we must pass this bridge instead of the previous boolean all the way to org.hibernate.search.mapper.pojo.mapping.building.impl.PojoIdentityMappingCollectorImpl#implicitProvidedId.

Then we must change org.hibernate.search.mapper.pojo.mapping.building.impl.PojoIdentityMappingCollectorImpl#applyDefaults to instantiate the bridge if the bean reference is non-null.

Then we must change org.hibernate.search.mapper.pojo.bridge.runtime.impl.ProvidedStringIdentifierMapping to use the bridge. It won't be a singleton anymore, obviously. It will be very similar to org.hibernate.search.mapper.pojo.bridge.runtime.impl.PropertyIdentifierMapping, but not identical.

Environment

None

Assignee

Fabio Massimo Ercoli

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Fix versions

Priority

Major
Configure