Hi,

while working on OGM-781 I noticed that there is a problem with Hibernate
Search when trying to get the projection of a property that represents a
collection of elements..

EntityInfo#getProjections()[0] will always return the first value of the
association.

For example, if I index the following entity:

    @Indexed
    public static class ExampleEntity {

        @Field(store = Store.YES)
        Integer someInteger;

        ...

        @Field(store = Store.YES)
        @IndexedEmbedded
        List<Integer> someCollection;
    }

and than add a projection on  "someCollection"

EntityInfo.getProjection()[0] will only return the first result of the
collection instead of returning a List<Integer>.

This seems a bug to me.
I've already created a local branch that should fix the behaviour in this
case.

It also makes me wonder, what should we do with a list of embeddables?

For example:

@Field(store = Store.YES)
@IndexedEmbedded
List<ExampleEntity> nestedExamples

In this case,  would it make sense to project "someCollection.someInteger"?
And what would be the expected result calling EntityInfo.getProjection()[0]?

Cheers,
Davide
_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to