Details
Assignee
UnassignedUnassignedReporter
Yoann RodièreYoann RodièreComponents
Priority
Major
Details
Details
Assignee
Unassigned
UnassignedReporter
Yoann Rodière
Yoann RodièreComponents
Priority
Created November 8, 2023 at 3:57 PM
Updated November 8, 2023 at 3:59 PM
org.hibernate.type.descriptor.java.JavaType
provides atoString
and afromString
method, which could map rather well to theIdentifier#toDocumentIdentifier
/Identifier#fromDocumentIdentifier
orValueBridge<?, String>#toIndexedValue
/ValueBridge<?, String>#fromIndexedValue
methods.We could provide a better out-of-the box experience, and remove the need for custom bridges in some cases, if, when we don’t find a relevant bridge for a given type:
We look at the value being mapped
If that value is a
@Basic
property without container extractor, or an@ElementCollection
of a basic type, we extract the correspondingJavaType
We default to a bridge that delegates to that
JavaType
as of the corresponding mapped propertyIf
Notes:
This can apply to document identifiers, in particular composite ones; see https://hibernate.atlassian.net/browse/HSEARCH-4355
This can apply to properties mapped as e.g.
@FullTextField
where the corresponding default bridge doesn’t yield a String fieldThis can apply to tenant identifiers as well, see https://hibernate.atlassian.net/browse/HSEARCH-5006
I mentioned
@Basic
properties above, but if theJavaType
for e.g. records supportstoString
/fromString
, we could consider handling@Embeddable
s as well.We could consider making this adapter explicit instead of implicit with e.g.
binder = @IdentifierBinderRef(name = HibernateOrmJavaTypeIdentifierBinder.NAME)