DATACASS-806 - Add support for suspend repository query methods returning List<T>.
This commit is contained in:
@@ -50,8 +50,8 @@ public class ReactiveCassandraQueryMethod extends CassandraQueryMethod {
|
||||
|
||||
super(method, metadata, projectionFactory, mappingContext);
|
||||
|
||||
this.isCollectionQuery = Lazy.of(() -> !(isPageQuery() || isSliceQuery())
|
||||
&& ReactiveWrappers.isMultiValueType(metadata.getReturnType(method).getType()));
|
||||
this.isCollectionQuery = Lazy.of(() -> (!(isPageQuery() || isSliceQuery())
|
||||
&& ReactiveWrappers.isMultiValueType(metadata.getReturnType(method).getType())) || super.isCollectionQuery());
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -40,6 +40,8 @@ class ReactiveCassandraQueryMethodCoroutineUnitTests {
|
||||
suspend fun findSuspendAllByName(): Flow<Person>
|
||||
|
||||
fun findAllByName(): Flow<Person>
|
||||
|
||||
suspend fun findSuspendByName(): List<Person>
|
||||
}
|
||||
|
||||
@Test // DATACASS-771
|
||||
@@ -59,4 +61,13 @@ class ReactiveCassandraQueryMethodCoroutineUnitTests {
|
||||
|
||||
assertThat(queryMethod.isCollectionQuery).isTrue()
|
||||
}
|
||||
|
||||
@Test // DATACASS-806
|
||||
internal fun `should consider suspended methods returning List as collection queries`() {
|
||||
|
||||
val method = PersonRepository::class.java.getMethod("findSuspendByName", Continuation::class.java)
|
||||
val queryMethod = ReactiveCassandraQueryMethod(method, DefaultRepositoryMetadata(PersonRepository::class.java), projectionFactory, CassandraMappingContext())
|
||||
|
||||
assertThat(queryMethod.isCollectionQuery).isTrue()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user