# Envers ManyToOne Audited Attributes are Empty/Nulll. Intentional?

**URL:** <https://discourse.hibernate.org/t/envers-manytoone-audited-attributes-are-empty-nulll-intentional/11122>\
**Category:** Hibernate ORM\
**Created:** [February 25, 2025, 8:44pm UTC](https://discourse.hibernate.org/t/envers-manytoone-audited-attributes-are-empty-nulll-intentional/11122 "2025-02-25T20:44:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rossnewby](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/rossnewby/32/3770_2.png) [@rossnewby](https://discourse.hibernate.org/u/rossnewby)\
**Post date:** [February 25, 2025, 8:44pm UTC](https://discourse.hibernate.org/t/envers-manytoone-audited-attributes-are-empty-nulll-intentional/11122/1 "2025-02-25T20:44:56Z")

</div>

Hi,

I am auditing the following (simplified) entity:

```auto
@Table(name = "constituent_entity")
public class ConstituentEntity {

    @Audited
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumns(<...mappings...>)
    private Constituent constituent;

    @Audited
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(<...mapping...>)
    private BaseEntity entity;
}

```

```auto
@Table(name = "entity")
public class BaseEntity {

    @Audited(withModifiedFlag = true, modifiedColumnName = "name_mod")
    private String name;

    ...

    @Audited
    @AuditJoinTable(name = "constituent_entity_aud")
    @OneToMany(mappedBy = "entity")
    private List<ConstituentEntity> constituentEntities = new ArrayList<>();
}

```

```auto
public class Constituent {

    @Audited(withModifiedFlag = true, modifiedColumnName = "name_mod")
    private String name;
    ...

    @Audited
    @AuditJoinTable(name = "constituent_entity_aud")
    @OneToMany(mappedBy = "constituent")
    private List<ConstituentEntity> constituentEntities = new ArrayList<>();
}

```

When saving a new ConstituentEntity, the audit table (constituent\_entity\_aud) populates correctly, however the row that gets inserted for constituent & entity, in their respective audit tables (constituent\_aud and entity\_aud), contain _only_ the ID attribute of the record

For example, creating a ConstituentEntity will add a row to constituent\_entity\_aud, constituent\_aud and entity\_aud, but the ‘name’ column in both constituent\_aud and entity\_aud are null, rather than their current value

Is this intended?

When fetching the ConstituentEntity revision, it would be helpful to know the state of the Constituent and BaseEntity, but right now it is not getting stored - COuld there be something wrong with my configuration?

I am running hibernate envers version 6.6.4

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [February 26, 2025, 12:23pm UTC](https://discourse.hibernate.org/t/envers-manytoone-audited-attributes-are-empty-nulll-intentional/11122/2 "2025-02-26T12:23:33Z")

</div>

It sounds like a bug to me. Please try to create a reproducer with our [test case template](https://github.com/hibernate/hibernate-test-case-templates/blob/master/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java) and if you are able to reproduce the issue, create a bug ticket in our [issue tracker](https://hibernate.atlassian.net) and attach that reproducer.
