Make Hibernate Search be compatible with Envers


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:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 01:03:18,352 ERROR [] Failed to start quarkus: java.lang.ExceptionInInitializerError at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance( at sun.reflect.DelegatingConstructorAccessorImpl.newInstance( at java.lang.reflect.Constructor.newInstance( at java.lang.Class.newInstance( at at at at Caused by: java.lang.RuntimeException: Failed to start quarkus at io.quarkus.runner.ApplicationImpl1.<clinit>(ApplicationImpl1.zig:245) ... 9 more Caused by: org.hibernate.MappingException: component class not found: null at org.hibernate.mapping.Component.getComponentClass( at at at at at at$HibernateSearchIntegrationListener.onMetadataInitialized( at io.quarkus.hibernate.orm.runtime.integration.HibernateOrmIntegrations.onMetadataInitialized( at at io.quarkus.hibernate.orm.runtime.PersistenceUnitsHolder.createMetadata( at io.quarkus.hibernate.orm.runtime.PersistenceUnitsHolder.constructMetadataAdvance( at io.quarkus.hibernate.orm.runtime.PersistenceUnitsHolder.initializeJpa( at io.quarkus.hibernate.orm.runtime.HibernateOrmRecorder$4.created( at io.quarkus.arc.runtime.ArcRecorder.initBeanContainer( at io.quarkus.deployment.steps.ArcProcessor$generateResources12.deploy_0(ArcProcessor$generateResources12.zig:364) at io.quarkus.deployment.steps.ArcProcessor$generateResources12.deploy(ArcProcessor$generateResources12.zig:36) at io.quarkus.runner.ApplicationImpl1.<clinit>(ApplicationImpl1.zig:231) ... 9 more Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [null] at io.quarkus.hibernate.orm.runtime.service.FlatClassLoaderService.classForName( at org.hibernate.mapping.Component.getComponentClass( ... 25 more Caused by: java.lang.NullPointerException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName( at io.quarkus.hibernate.orm.runtime.service.FlatClassLoaderService.classForName( ... 26 more

To Reproduce

Steps to reproduce the behavior:

1. git clone
2. checkout branch search_with_auditing
3. run the application using the script

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 :

1 2 3 4 for ( PersistentClass persistentClass : persistentClasses ) { collectEmbeddedTypesRecursively( typeMetadata, persistentClass.getIdentifier() ); collectEmbeddedTypesRecursively( typeMetadata, persistentClass.getPropertyIterator() ); }

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:








Damien Clement d'Huart


Damien Clement d'Huart



Suitable for new contributors


Feedback Requested


Fix versions

Affects versions