Issues

Select view

Select search mode

 

Cannot invoke "org.hibernate.envers.internal.entities.EntityConfiguration.getRelationDescription(String)" because "entCfg" is null

Fixed

Description

I'm migrating from Hibernate Envers 5.x to 6. In my project there are a few entities with many-to-many relationships, the junction tables are represented with entities, having a few additional fields. In these entities both sides of the relationship are @ManyToOne fields.

I have a custom RevisionListener which checks for the last two revisions of the modified entity and creates a diff from it. In this listener the AuditReader#find method throws a NullPointerException:

There is a change in the ToOneIdMapper class since hibernate 6.0 that might be causing the issue:

In 5.x there used to be a check for whether the referenced entity is audited, and since it is, it was skipped in 5.x:
if ( !referencedEntity.isAudited())

Now it tries to get the referencingEntityName, but since the map contains no $type$, it is null and later in the EntitiesConfigurations#getRelationDescription it causes a NPE, because neither of the paths provide an EntityConfiguration here:

So it throws a NPE here: https://github.com/hibernate/hibernate-orm/blob/6.2/hibernate-envers/src/main/java/org/hibernate/envers/internal/entities/EntitiesConfigurations.java#L101

I haven't found anything about it in the migration docs, am i missing something?

I've created a repo for showcasing my issue:

Any help would be greatly appreciated.

Details

Assignee

Reporter

Labels

Worked in

Components

Fix versions

Affects versions

Priority

Created January 18, 2024 at 1:48 PM
Updated February 13, 2025 at 10:17 AM
Resolved January 7, 2025 at 3:56 PM

Activity

Ádám KovácsJanuary 18, 2024 at 3:32 PM
Edited

I’ve submitted a PR with the missing if condition

Flag notifications