#250 - Polishing.
Use Cassandra streaming query with query derivation instead of a String-based query.
This commit is contained in:
committed by
Oliver Gierke
parent
54ab8178b7
commit
319d3e1a17
@@ -37,8 +37,7 @@ public interface PersonRepository extends Repository<Person, String> {
|
||||
*/
|
||||
Optional<Person> findOne(String id);
|
||||
|
||||
@Query("select * from person")
|
||||
Stream<Person> streamAllPeople();
|
||||
Stream<Person> findAll();
|
||||
|
||||
/**
|
||||
* Sample method to derive a query from using JDK 8's {@link Optional} as return type.
|
||||
|
||||
@@ -81,7 +81,7 @@ public class Java8IntegrationTests {
|
||||
Person homer = repository.save(new Person("1", "Homer", "Simpson"));
|
||||
Person bart = repository.save(new Person("2", "Bart", "Simpson"));
|
||||
|
||||
try (Stream<Person> stream = repository.streamAllPeople()) {
|
||||
try (Stream<Person> stream = repository.findAll()) {
|
||||
assertThat(stream.collect(Collectors.toList()), hasItems(homer, bart));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user