fix: a TooManyRowsException may crash the scan

This commit is contained in:
Gauthier Roebroeck 2022-02-04 11:51:33 +08:00
parent 656f433b9d
commit 0368060166
2 changed files with 6 additions and 2 deletions

View file

@ -43,7 +43,9 @@ class BookDao(
dsl.selectFrom(b)
.where(b.LIBRARY_ID.eq(libraryId).and(b.URL.eq(url.toString())))
.and(b.DELETED_DATE.isNull)
.fetchOneInto(b)
.orderBy(b.LAST_MODIFIED_DATE.desc())
.fetchInto(b)
.firstOrNull()
?.toDomain()
private fun findByIdOrNull(dsl: DSLContext, bookId: String): Book? =

View file

@ -58,7 +58,9 @@ class SeriesDao(
dsl.selectFrom(s)
.where(s.LIBRARY_ID.eq(libraryId).and(s.URL.eq(url.toString())))
.and(s.DELETED_DATE.isNull)
.fetchOneInto(s)
.orderBy(s.LAST_MODIFIED_DATE.desc())
.fetchInto(s)
.firstOrNull()
?.toDomain()
override fun findAllByTitle(title: String): Collection<Series> =