Skip to content

Commit

Permalink
Polishing.
Browse files Browse the repository at this point in the history
Minor formatting and references to GH issues.

See #1714
Original pull request #1963
  • Loading branch information
schauder committed Jan 16, 2025
1 parent ea29642 commit b51c77b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ public <T> List<T> findAll(Class<T> domainType) {

@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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ public <T> List<T> findAll(Class<T> domainType) {

@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);
Expand All @@ -277,12 +278,14 @@ public <T> Stream<T> streamAll(Class<T> domainType) {

@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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ void findByNonPropertySortFails() {

@Test // GH-1714
void findByNonPropertySortLikeStreamFails() {

assertThatThrownBy(() -> template.streamAll(LegoSet.class, Sort.by("somethingNotExistant")))
.isInstanceOf(InvalidPersistentPropertyPath.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public void findAll() {
);
}

@Test
@Test // GH-1714
public void streamAll() {

String value = "some answer";
Expand Down Expand Up @@ -299,7 +299,7 @@ public void findAllById() {
);
}

@Test
@Test // GH-1714
public void streamAllByIds() {

String value = "some answer 2";
Expand Down Expand Up @@ -430,7 +430,7 @@ public void findAllSorted() {
);
}

@Test
@Test // GH-1714
public void streamAllSorted() {

String value = "some answer 3";
Expand Down

0 comments on commit b51c77b

Please sign in to comment.