"AssertionFailure: Unexpected duplicate key" when an entity has two getters for the same property

Description

It's technically possible to write a class with a duplicate getter, e.g.:

Currently, when Hibernate Search encounters such a property, it will throw a cryptic exception at bootstrap:

We should at least avoid the error when the property is not used in the Hibernate Search mapping, and probably just pick one of the getter and log a warning when the property is used.

Activity

Show:

lan zen January 28, 2021 at 5:57 AM

I also cause this failure

It’s message too simple and I found it very hard

Finally I find it’s problem, like this:

my pojo:

and org.hibernate.search.mapper.pojo.model.hcann.spi.AbstractPojoHCAnnBootstrapIntrospector#declaredFieldAccessXPropertiesByName

cause,

when I delete isValid method, It’s okay…

Fixed

Details

Assignee

Reporter

Components

Sprint

Priority

Created November 24, 2020 at 7:43 AM
Updated February 23, 2021 at 2:00 PM
Resolved January 28, 2021 at 12:05 PM