Yoann Rodière (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HSEARCH-4895 (
https://hibernate.atlassian.net/browse/HSEARCH-4895?atlOrigin=eyJpIjoiMWI...
)
Re: `.id()` projection / `@IdProjection` within object fields (
https://hibernate.atlassian.net/browse/HSEARCH-4895?atlOrigin=eyJpIjoiMWI...
)
We already have some support of “object IDs” at the mapper level (see
@IndexedEmbedded#includeEmbeddedObjectId ), so this would mostly involve formalizing the
concept at the backend level (allowing to declare “id fields” or marking one field of an
object as an “id”).
Then we could allow this in the predicate/projection DSL:
f.id("path.to.myobjectfield") or
f.id().field("path.to.myobjectfield").
And finally, we should be able to take advantage of those DSLs in the IdProjectionBinder
to project on object IDs.
There is one alternative: define a completely separate predicate/projection for object
IDs. But that doesn’t play well with composition of projection constructors: in the
example above, one would need to have two separate definitions of AuthorDTO : one for
inclusion in BookDTO}}when querying the {{book index, using @ObjectIdProjection , and for
top-level use when querying the author index, using @IdProjection. That’s a shame when we
already allow advanced composition using
@ObjectProjection(includeDepth/includePaths/excludePaths).
Maybe @ObjectIdProjection would make sense if we also introduced something like
@RootOrObjectIdProjection , but this feels really clumsy…
(
https://hibernate.atlassian.net/browse/HSEARCH-4895#add-comment?atlOrigin...
) Add Comment (
https://hibernate.atlassian.net/browse/HSEARCH-4895#add-comment?atlOrigin...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100229- sha1:634ba05 )