Questions tagged [spring-data-envers]

Spring Data Envers offers the popular Repository abstraction of Spring Data to Envers revisions. This means you can query Revisions with the same mechanics as your main entities.

What is Spring Data Envers?

Spring Data Envers makes typical Envers queries available in repositories for Spring Data JPA. It differs from other Spring Data modules in that it is always used in combination with another Spring Data Module: Spring Data JPA.

What is Envers?

Envers is a Hibernate module that adds auditing capabilities to JPA entities. This documentation assumes you are familiar with Envers, just as Spring Data Envers relies on Envers being properly configured.

GitHub Repository: https://github.com/spring-projects/spring-data-envers

Project Page: http://projects.spring.io/spring-data-envers/

Reference Documentation: https://docs.spring.io/spring-data/envers/docs/current/reference/html/

The underlying Envers project: http://hibernate.org/orm/envers/

61 questions
1
vote
0 answers

Integration Testing Spring Data Envers using Testcontainers and Spring Boot DataJpaTest

I recently integrated Envers (Spring Data Envers) into my microservice and I'd like to test it. I'm able to get my test to spin up a Testcontainer (Postgresql), run the Flyway migrations to create the tables, and do inserts into the tables using a…
Mark
  • 4,970
  • 5
  • 42
  • 66
1
vote
0 answers

How to output contents of _aud table as JSON?

I would like to display the contents of my _aud table in a JSON array like this: [ { "id":1, "rev":1, "revtype":0, "created_date":xxxx, "modified_date":yyyy } ] How do I write my controller GET method? I had written…
Andrew
  • 80
  • 7
1
vote
0 answers

Hibernate Envers did not save the initial state of the entity in the history table

The initial state disappears when the username or surname was changed. Time #1 users table | id | firstName | lastName | |--------------------------------------|-----------|----------| |…
1
vote
1 answer

No revision data from repository with Spring Data Envers

I've implemented a Spring Data JPA+Envers repository which works fine, according to what I've been monitoring into the database. @SpringBootApplication @EnableTransactionManagement @EnableEnversRepositories public class ToDoApplication { public…
Thomas Escolan
  • 1,298
  • 1
  • 10
  • 28
1
vote
1 answer

Spring data envers - revinfo table and entity_aud doesn't exist

I have added envers to my Spring Boot project with @Audited, extended my JpaRepository with RevisionRepository, have a @EnableJpaRepositories(repositoryFactoryBeanClass = EnversRevisionRepositoryFactoryBean.class). I am…
PredictableBeaco
  • 97
  • 1
  • 1
  • 8
1
vote
1 answer

Hibernate Envers - delete revisions when entity is deleted

is there possibility to set Hibernate Envers so that when ever I delete original entity all revisions of it are deleted also? I need to track the history only when the original entity exists.
1
vote
3 answers

Error when adding custom revision in Hibernate envers

When I add custom revision entity, I start getting error: 2020-12-13 00:22:29.418 ERROR 80983 --- [ost-startStop-1] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception:…
farahm
  • 1,326
  • 6
  • 32
  • 70
1
vote
1 answer

Is there way to record audit database in spring boot using Spring Data Envers with spring JDBCTemplate?

I'm creating a spring web application that uses the MySQL database with spring JDBCTemplate. The problem is I want to record any changes in data that store in the MySQL database. I couldn't find any solution for Spring Data Envers with JDBCTemplates…
1
vote
1 answer

Hibernate envers: how to get the current audited table name?

With Hibernate Envers, is it possible to get the current audited table? I took the example from the doc but I add an extra column tableName: @Entity @RevisionEntity(ExampleListener.class) public class ExampleRevEntity extends DefaultRevisionEntity…
akuma8
  • 4,160
  • 5
  • 46
  • 82
1
vote
1 answer

Spring Data Envers Entity must not be null

Suppose we have audited entities with @OneToOne relation: @Entity @Audited @Table(name = "product") public class Product { @Id @GeneratedValue @Column(name = "id") private Long id; @Column(name = "name") private String name; …
Andrii Bobrov
  • 79
  • 1
  • 6
1
vote
1 answer

Using Spring data jpa auditing to log into tables other than the entity’s table

In Hibernate Envers it is possible to have a separate audit table. Similarly, is it possible to log into tables other than the entity’s table using Spring Data JPA auditing?
1
vote
0 answers

Make Spring envers Revisions HATEOAS compatible

I'm using Spring Boot, Spring Data REST, Spring Data Envers, Hibernate. I'm loading all revisions of my entity using Spring Data Envers: @GetMapping(path = "/fines/{id}/revisions") public ResponseEntity findRevisions(@PathVariable(value =…
drenda
  • 5,846
  • 11
  • 68
  • 141
1
vote
0 answers

How to disable AuditEntityListener (Spring Data) temporary?

We use Spring Data with die AuditEntityListener to update the change-user and the changedate. But for our migration (Spring Batch) of old data we need to set the create-user and the change-user manualy, but we cannot disable the functionality of the…
grueny
  • 81
  • 4
1
vote
0 answers

spring-data-envers -2.0.0.RELEASE

Right now we are using 0.3.0.RELEASE to get the revision data and noticed that the revisions are fetched in ascending order. the existing code @EnableJpaRepositories( value = "org.xxx.xxx.xxx.repository", repositoryFactoryBeanClass =…
0
votes
1 answer

Hibernate uses @JoinColumn as sequence name instead of table name

Recently migrated to spring boot 3 and have run into the following issue. @Audited @Entity class ParentEntity { ... @NotAudited @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY) @JoinColumn(name =…
MFEB
  • 131
  • 1
  • 8