Make Hibernate Search be compatible with Envers

Description

Expected behavior

I would like to mix hibernate search and envers together. The main goal would be to be able to audit my entity and to have a searchable projection of it using elasticsearch. I do not want to have a representation in elasticsearch of _aud tables and DefaultRevisionEntity.

Current behavior

I made a Quarkus POC to reproduce the current behavior.

The application fails to start due to an exception thrown at startup:

To Reproduce

Steps to reproduce the behavior:

1. git clone https://github.com/dcdh/poc-quarkus-persistence.git
2. checkout branch search_with_auditing
3. run the application using the script run_dev.sh

Additional information

The exception occurs because the auditable table is not associated with a JPA entity.

The impacted code is this one from the class HibernateOrmBootstrapIntrospector :

The auditable tabe is considered as a persistentClasses and when the code will try to collect all embeded type recursively an exception will be thrown and the application will fail.

I notice that for an audited table the className property is null. Maybe that it could be a solution to filter and reject all table persistentClasses having a null className ? and add a special case (or not) regarding the DefaultRevisionEntity but it will introduce a high coupling with Envers...

Quarkus opened issue:

 

Regards,

Damien

Environment

hibernate-search-mapper-orm

Status

Assignee

Damien Clement d'Huart

Reporter

Damien Clement d'Huart

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Fix versions

Affects versions

Priority

Major
Configure