import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
-import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.data.repository.history.RevisionRepository;
import de.spring.example.persistence.domain.Ad;
import de.spring.example.persistence.domain.AdDescription;
* Be careful with <code>@Transactional</code>. SimpleJpaRepository has annotated methods.
*
*/
-public interface AdDescriptionRepository extends PagingAndSortingRepository<AdDescription, Long>, QueryDslPredicateExecutor<AdDescription> {
+public interface AdDescriptionRepository extends
+ PagingAndSortingRepository<AdDescription, Long>,
+ /** https://github.com/spring-projects/spring-data-envers/pull/45 QueryDslPredicateExecutor<AdDescription>, **/
+ RevisionRepository<AdDescription, Long, Integer> {
// Custom Query method (useful when the offered methods by PagingAndSortingRepository are not enough)
Page<AdDescription> findByAd(Ad ad, Pageable pageable);
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.data.repository.history.RevisionRepository;
import org.springframework.data.repository.query.Param;
import de.spring.example.persistence.domain.Ad;
* Be careful with <code>@Transactional</code>. SimpleJpaRepository has annotated methods.
*
*/
-public interface AdRepository extends PagingAndSortingRepository<Ad, Long>, JpaSpecificationExecutor<Ad> {
+public interface AdRepository extends
+ PagingAndSortingRepository<Ad, Long>,
+ JpaSpecificationExecutor<Ad>,
+ RevisionRepository<Ad, Long, Integer> {
// Named Native Query (using the native language of the store) It is not portable.
// See de.spring.persistence.example.domain.Ad
<context:annotation-config />\r
\r
<context:component-scan base-package="de.spring.example.persistence" />\r
+\r
+ <jpa:repositories entity-manager-factory-ref="entityManagerFactory"\r
+ base-package="de.spring.example.persistence.**.repository"\r
+ transaction-manager-ref="transactionManager"\r
+ factory-class="org.springframework.data.envers.repository.support.EnversRevisionRepositoryFactoryBean" />\r
\r
<bean id="entityManagerFactory"\r
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">\r
</property>\r
</bean>\r
\r
- <jpa:repositories entity-manager-factory-ref="entityManagerFactory"\r
- base-package="de.spring.example.persistence.**.repository"\r
- transaction-manager-ref="transactionManager" />\r
+\r
\r
</beans>\r
final QAdDescription adDescription = QAdDescription.adDescription1;
final BooleanExpression adDescriptionHasAdLink = adDescription.adLink.contains("gumartinm");
final BooleanExpression adDescriptionHasDescription = adDescription.adDescription.contains("babucha");
-
- return repository.findAll(adDescriptionHasAdLink.and(adDescriptionHasDescription), pageRequest);
+ /**
+ * https://github.com/spring-projects/spring-data-envers/pull/45
+ * return repository.findAll(adDescriptionHasAdLink.and(adDescriptionHasDescription), pageRequest);
+ */
+ return null;
}
}