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
8
votes
1 answer

Spring Data Envers org.springframework.data.mapping.PropertyReferenceException: No property findRevisions found for type

I have a Spring boot 1.4.2 application with Hibernate 5.2.6 and Spring data Envers 1.0.5. I am auditing my entities and the audit records are persisted properly. My application config class is annotated to use the…
5
votes
1 answer

Mixing Spring Data Envers and QueryDSL

I'm using a global custom repository in my project which extends QueryDslJpaRepository: public class CustomPagingAndSortingRepositoryImpl extends QueryDslJpaRepository implements…
mfc
  • 313
  • 1
  • 3
  • 15
4
votes
1 answer

Envers audit table does not rollback in spring-boot integration tests annotated with @Transactional

I am trying to figure out why @Transactional does not rollback data in envers audit table after each test and how to fix it. How can I make that happen in spring integration tests? I have tried with @DirtiesContext and that makes it work but it's…
3
votes
2 answers

Looping over items of a jpa streamresult and call an update service. Envers create an revision over all items instead for every single item

I loop over person entities of a jpa streamresult and call for every single person an update service bean to update the name of the person entity. I understand, that envers is executed at the end of the transaction. Ok this works fine and all…
2
votes
1 answer

Connection is closed with data-envers

I am working with data-envers in my Spring-Boot project in a development environment. When the microservice has been up for approximately 8 hours, the connection to the database stops working (only the queries that are used with data-envers, that…
Talenel
  • 422
  • 2
  • 6
  • 25
2
votes
0 answers

Spring Data Envers: get revision number as part of the entity

I want latest revision number always to be known when saving/finding an entity. Can I have something like this, so latest revision number is always present in the entity? @Entity @Audited class SomeEntity { @Id long id; String value; …
2
votes
1 answer

Dynamically creating spring EnversRevisionRepository from a Java Class

How does one create an EnversRevisionRepository dynamically given a Java Class object? Thanks to this answer https://stackoverflow.com/a/22342025/3771679 one can successfully create a JpaRepository dynamically, but I would like to achieve the same…
2
votes
1 answer

Custom audit logging vs Hibernate Envers

I need to implement audit logging for a web application I build. I am using Spring Boot, MySQL and JPA (Hibernate) in development. I know there are solutions like Hibernate Envers for auditing at the Entity level. The problem is that the user (an…
sanemain
  • 139
  • 1
  • 13
2
votes
1 answer

Why Spring Data Envers Revision Type returned UNKOWN?

What i trying to achieve is the revision type that print out UNKNOWN in the response, but in the database exist the revtype. Here is the response : { "metadata": { "delegate": { "id": 1, "timestamp": 1594199577086, …
2
votes
0 answers

Spring Data Envers + Liquibase: how to create audited tables and update them automatically?

I would like to audit my models in my Spring Boot app. I use Liquibase for db migration. Say I have this entity : @Entity @Audited public class User { @Id private Long id; private String name; private String firstName; } I create the user table…
2
votes
1 answer

How to track delete events with Spring Data JPA Auditing and Envers?

In my audited entity i have fields: @LastModifiedBy private String lastModifiedBy; @LastModifiedDate private OffsetDateTime lastModifiedDate; But they doesn't change when entity is deleted. As i understand, i need to customize…
2
votes
1 answer

How to target specific Envers revision in entity relationship to @Audited entity?

I need to maintain entity A relationship to certain revision of @Audited entity B, so that the relationship doesn't always point to the latest version (which is the default behaviour). Is there a framework feature (or recommended solution) for…
Michal
  • 2,078
  • 23
  • 36
2
votes
1 answer

EnversRevisionRepositoryFactoryBean dosenot create bean for JPARepositories

I am using spring boot, hibernate enverse. I have following dependency in pom.xml org.springframework.data spring-data-envers following is my envers…
Prashant Shilimkar
  • 8,402
  • 13
  • 54
  • 89
2
votes
1 answer

How can we use spring-data-jpa-datatables spring-data-envers together in one project

I have this enabled in my database config. Which enabled to fetch Audit logs with the help of JPA methods. (spring-data-envers) is being used in POM for this @EnableJpaRepositories( repositoryFactoryBeanClass =…
2
votes
2 answers

Spring Data envers: How to get value REVTYPE from revision object

I am trying to implement auditing of entity using spring data envers. I am able to obtain all or single Revision object for entity as Revisions revisions = userRepository.findRevisions(id); I want to get REVTYPE value for particular…
1
2 3 4 5