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

Envers Query API throws NullPointerException when providing a non-audited entity class.

Description

When using a query API such as:

1 2 3 auditReader.createQuery().forRevisionsOfEntity( SomeNonAuditedEntity.class, false, false ) .add( AuditEntity.property( "someProperty.someNested" ).eq( someValue ) ) .getResultList();

will cause a `NullPointerException` when attempting to locate relation information.

1 2 3 4 5 6 java.lang.NullPointerException at org.hibernate.envers.internal.entities.EntitiesConfigurations.getRelationDescription(EntitiesConfigurations.java:98) at org.hibernate.envers.query.criteria.internal.CriteriaTools.getRelatedEntity(CriteriaTools.java:44) at org.hibernate.envers.query.criteria.internal.SimpleAuditExpression.addToQuery(SimpleAuditExpression.java:45) at org.hibernate.envers.query.internal.impl.RevisionsOfEntityQuery.list(RevisionsOfEntityQuery.java:89) at org.hibernate.envers.query.internal.impl.AbstractAuditQuery.getResultList(AbstractAuditQuery.java:93)

The query API should likely throw a more relevant exception such as:

1 QueryException: Cannot query audit history on a non-audited entity [%s].

Environment

None

Status

Assignee

Chris Cranford

Reporter

Chris Cranford

Components

Fix versions

Affects versions

5.0.11
5.1.4
5.2.8

Priority

Major