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.
I made a Quarkus POC to reproduce the current behavior.
The application fails to start due to an exception thrown at startup:
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
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:
I’ve found some clue here AdditionalJaxbMappingProducerImpl about an EnversService …
However in hibernate core… should not touch.
Thanks for the report and insightful analysis. We'll look into this.
I think a first step would be to migrate the Envers tests from Search 5 to Search 6, preferably in a separate module (hibernate-search-integrationtest-mapper-orm-envers, something like that). Then we'll see what we can do.
Ok, so you even sent a PR, I missed that Continuing the discussion there.