Oliver Gierke 5cf6501592 Initial draft of Envers support for Spring Data JPA.
Added an implementation of the Spring Data Commons historiography API based on Hibernate Envers. The implementation is a contribution of @hygl to a large degree.
2012-03-21 15:04:22 +01:00

Spring Data Envers

This project is an extension of the Spring Data JPA project to allow access to entity revisions managed by Hibernate Envers. The sources mostly originate from a contribution of Philip Hügelmeyer @hygl.

The core feature of the module consists of an implementation of the RevisionRepository of Spring Data Commons.

public interface RevisionRepository<T, ID extends Serializable, N extends Number & Comparable<N>> {

	Revision<N, T> findLastChangeRevision(ID id);

	Revisions<N, T> findRevisions(ID id);

	Page<Revision<N, T>> findRevisions(ID id, Pageable pageable);
}

You can pull in this functionality to your repositories by simply additionally extending the interface just mentioned:

interface PersonRepository extend RevisionRepository<Person, Long, Long>, CrudRepository<Person, Long> {

  // Your query methods go here
}

To successfully activate the Spring Data Envers repository factory use the Spring Data JPA repositories namespace element's factory-class attribute:

<jpa:repositories base-package="com.acme.repositories"
                  factory-class="….EnversRevisionRepositoryFactoryBean" />

Contributing to the project

If you're an Eclipse user make sure you activate automatic application of the formatter (located at etc/eclipse-formatter.xml) and activate automatic formatting and organizing imports on save.

Description
No description provided
Readme 1.8 MiB
Languages
Java 100%