Hibernate Envers (Entity Auditing) — Concept Check
Questions on Hibernate Envers (Entity Auditing). @Audited on an entity instructs Envers to record every change in a revision table; query historical data with AuditReader to retrieve entity state at a specific revision.
Questions in this quiz
8 questions on Hibernate Envers (Entity Auditing) — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A developer wants to exclude a field from being audited in Hibernate Envers. Which annotation should they use?
- A@ExcludeAudit
- B@IgnoreAudit
- C@NoAudit
- D@NotAudited
2.A product's price was updated, but the change is not reflected in the audit table. What might be the cause?
- AThe entity is not annotated with @Audited.
- BThe audit table is not created.
- CThe database is read-only.
- DThe revision table is missing.
3.Which table does Hibernate Envers automatically create to store revision information?
- Arevinfo
- Bchange_history
- Crevision_data
- Daudit_log
4.How can you retrieve all revisions of an entity using Spring Data Envers?
- AUse findRevisions() method in RevisionRepository.
- BUse getRevisions() method in AuditReader.
- CUse findAll() method in JpaRepository.
- DUse getAllRevisions() method in EntityManager.
5.A developer sees that the audit table has no entries after several updates. What should they check first?
- AEnsure @Audited is on the entity.
- BCheck if the database is online.
- CVerify the application logs.
- DRestart the application server.
6.What happens if you annotate an entity with @Audited in Hibernate Envers?
- AA mirror audit table is created for the entity.
- BThe entity is deleted after auditing.
- CAll fields are encrypted.
- DThe entity becomes immutable.
7.Using AuditReader, how can you find the state of an entity at a specific revision?
- AUse the find() method with entity class, ID, and revision.
- BUse getState() with entity ID and revision.
- CInvoke retrieve() with entity class and revision.
- DCall getEntityState() with revision number.
8.A developer mistakenly believes that deleting an entity does not create a revision entry. What is the truth?
- ADELETE operations create a new revision entry.
- BDELETE operations are ignored by Envers.
- CDELETE operations overwrite the last revision.
- DDELETE operations require manual audit entry.