.netnhibernatenhibernate-envers

nHibernate Envers Get history record for deleted revision


I store entity changes in database using Envers. I configured StoreDataAtDelete parameters to true and is works fine. Database contains history data.

However, when I try to query audit data to get historical record state for deleted revision, I get an empty result.

_session.Auditer().CreateQuery()
    .ForEntitiesAtRevision<TEntity>(revisionId)
    .Add(AuditEntity.Id().Eq(recordId))
    .Results();

In database, for this revision there is full record data in audit table. Is there any possibility to get data for deleted revision?


Solution

  • Probably just an overload that is missing.

    Does it work if you use

    ForEntitiesAtRevision("TEntity", revisionId, true)
    

    instead?

    Report it to the Jira if you want to.