We're updating the issue view to help you get more done. 

MassIndexer fails for entities with primitive ID type

Description

1 2 3 4 5 6 7 Caused by: java.lang.IllegalArgumentException: Attribute [io.quarkus.test.hibernate.search.elasticsearch.search.Person#id : long] not castable to requested type [java.lang.Object] at org.hibernate.metamodel.model.domain.internal.AbstractIdentifiableType.checkType(AbstractIdentifiableType.java:129) at org.hibernate.metamodel.model.domain.internal.AbstractIdentifiableType.getId(AbstractIdentifiableType.java:93) at org.hibernate.search.mapper.orm.massindexing.impl.BatchIndexingWorkspace.<init>(BatchIndexingWorkspace.java:74) at org.hibernate.search.mapper.orm.massindexing.impl.BatchCoordinator.doBatchWork(BatchCoordinator.java:124) at org.hibernate.search.mapper.orm.massindexing.impl.BatchCoordinator.runWithErrorHandler(BatchCoordinator.java:92) at org.hibernate.search.mapper.orm.massindexing.impl.ErrorHandledRunnable.run(ErrorHandledRunnable.java:29)

It seems this call:

1 this.idNameOfIndexedType = sessionFactory.getMetamodel().entity( indexedType ).getId( Object.class ).getName();

should be replaced with this:

1 this.idNameOfIndexedType = sessionFactory.getMetamodel().entity( indexedType ).locateIdAttribute().getName();

Environment

None

Status

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Fix versions

Affects versions

6.0.0.Alpha2

Priority

Major