Polishing.

Minor formatting and references to GH issues.

See #1714
Original pull request #1963
This commit is contained in:
Jens Schauder
2025-01-16 10:45:27 +01:00
parent ea296429df
commit b51c77b50a
4 changed files with 8 additions and 3 deletions

View File

@@ -344,6 +344,7 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
@Override
public <T> Stream<T> streamAll(Class<T> domainType) {
Iterable<T> items = triggerAfterConvert(accessStrategy.findAll(domainType));
return StreamSupport.stream(items.spliterator(), false).map(this::triggerAfterConvert);
}

View File

@@ -269,6 +269,7 @@ public class MyBatisDataAccessStrategy implements DataAccessStrategy {
@Override
public <T> Stream<T> streamAll(Class<T> domainType) {
String statement = namespace(domainType) + ".streamAll";
MyBatisContext parameter = new MyBatisContext(null, null, domainType, Collections.emptyMap());
Cursor<T> cursor = sqlSession().selectCursor(statement, parameter);
@@ -277,12 +278,14 @@ public class MyBatisDataAccessStrategy implements DataAccessStrategy {
@Override
public <T> List<T> findAllById(Iterable<?> ids, Class<T> domainType) {
return sqlSession().selectList(namespace(domainType) + ".findAllById",
new MyBatisContext(ids, null, domainType, Collections.emptyMap()));
}
@Override
public <T> Stream<T> streamAllByIds(Iterable<?> ids, Class<T> domainType) {
String statement = namespace(domainType) + ".streamAllByIds";
MyBatisContext parameter = new MyBatisContext(ids, null, domainType, Collections.emptyMap());
Cursor<T> cursor = sqlSession().selectCursor(statement, parameter);

View File

@@ -389,6 +389,7 @@ abstract class AbstractJdbcAggregateTemplateIntegrationTests {
@Test // GH-1714
void findByNonPropertySortLikeStreamFails() {
assertThatThrownBy(() -> template.streamAll(LegoSet.class, Sort.by("somethingNotExistant")))
.isInstanceOf(InvalidPersistentPropertyPath.class);
}

View File

@@ -247,7 +247,7 @@ public class MyBatisDataAccessStrategyUnitTests {
);
}
@Test
@Test // GH-1714
public void streamAll() {
String value = "some answer";
@@ -299,7 +299,7 @@ public class MyBatisDataAccessStrategyUnitTests {
);
}
@Test
@Test // GH-1714
public void streamAllByIds() {
String value = "some answer 2";
@@ -430,7 +430,7 @@ public class MyBatisDataAccessStrategyUnitTests {
);
}
@Test
@Test // GH-1714
public void streamAllSorted() {
String value = "some answer 3";