Search code examples
genericsjpaentityreverse-engineeringgeneric-programming

How to do to have a generic Entity for SQL audit tables with JPA or Hibernate?


I want to show all datas of my audit tables in a jsf page from SQL server. I dont khnow how to do for this ? I have to khnow the fieled of every audit table in the database to create a Entity class , or there a generic Entity whitch can get every audit table ?

Thanx in advance.


Solution

  • I found that:

    AuditReader.getAuditReader()
        .createQuery()
        .forRevisionsOfEntity(EntityClass.class, false, true)
        .getResultList();
    

    to get All data of an Entity X in the Audit Table