Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public List<Person> findByFirstNameAndDateOfBirth(String firstName, LocalDate dateOfBirth) {
- return cassandraTemplate
- .getCqlOperations()
- .query(
- findByFirstNameAndDateOfBirthQuery(firstName, dateOfBirth),
- (row, rowNum) -> cassandraTemplate.getConverter().read(Person.class, row));
- }
- private BoundStatement findByFirstNameAndDateOfBirthQuery(
- String firstName, LocalDate dateOfBirth) {
- return CachedPreparedStatementCreator.of(
- cache,
- select()
- .all()
- .from("people_by_first_name")
- .where(eq("first_name", bindMarker("first_name")))
- .and(eq("date_of_birth", bindMarker("date_of_birth"))))
- .createPreparedStatement(session)
- .bind()
- .setString("first_name", firstName)
- .setDate("date_of_birth", toCqlDate(dateOfBirth));
- }
Add Comment
Please, Sign In to add comment