#553 - Adapt Spring Data Cassandra.

This commit is contained in:
Mark Paluch
2020-02-10 15:28:29 +01:00
parent c88ad331c0
commit 523d2c8a56
18 changed files with 72 additions and 97 deletions

View File

@@ -35,12 +35,6 @@ public interface OrderRepository extends Repository<Order, String> {
@Query("SELECT * from pizza_orders WHERE orderdate = ?0 and zoneid = ?1 ALLOW FILTERING")
Order findOrderByOrderDateAndZoneId(LocalDate orderDate, ZoneId zoneId);
/**
* Parameter conversion can be overridden by using the {@link CassandraType} annotation.
*/
@Query("SELECT * from pizza_orders WHERE orderdate = ?0 and zoneid = ?1 ALLOW FILTERING")
Order findOrderByDate(com.datastax.driver.core.LocalDate orderDate, String zoneId);
void deleteAll();
Order save(Order order);

View File

@@ -1,2 +1,3 @@
spring.data.cassandra.keyspace-name=example
spring.data.cassandra.schema-action=recreate
spring.data.cassandra.local-datacenter=datacenter1

View File

@@ -59,17 +59,4 @@ public class Jsr310IntegrationTests {
assertThat(repository.findOrderByOrderDateAndZoneId(order.getOrderDate(), order.getZoneId())).isEqualTo(order);
}
@Test
public void findOneByConvertedTypes() {
Order order = new Order("42", LocalDate.of(2010, 1, 2), ZoneId.systemDefault());
repository.save(order);
com.datastax.driver.core.LocalDate date = com.datastax.driver.core.LocalDate.fromYearMonthDay(2010, 1, 2);
String zoneId = order.getZoneId().getId();
assertThat(repository.findOrderByDate(date, zoneId)).isEqualTo(order);
}
}