DATAJPA-665 - Add QueryDslJpaRepository.exists(…) method wich accepts a Querydsl predicate.

Introduced QueryDslJpaRepository.exists(Predicate) method to QueryDslJpaRepository.

Related ticket: DATACMNS-636.
Original pull request: #131.
This commit is contained in:
Thomas Darimont
2015-01-23 09:50:34 +01:00
committed by Oliver Gierke
parent e8436d5de7
commit 2a05e5e1c9
2 changed files with 21 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2014 the original author or authors.
* Copyright 2008-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -325,4 +325,15 @@ public class QueryDslJpaRepositoryTests {
assertThat(users, hasSize(3));
assertThat(users, hasItems(dave, carter, oliver));
}
/**
* @see DATAJPA-665
*/
@Test
public void shouldSupportExistsWithPredicate() throws Exception {
assertThat(repository.exists(user.firstname.eq("Dave")), is(true));
assertThat(repository.exists(user.firstname.eq("Unknown")), is(false));
assertThat(repository.exists((Predicate) null), is(true));
}
}