Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #213 from Z-Jais/master
Browse files Browse the repository at this point in the history
Replaced basic query methods with database.fullInitialize
  • Loading branch information
Ziedelth authored Nov 20, 2023
2 parents 1355300 + c052adc commit 8c6ee7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/main/kotlin/fr/ziedelth/repositories/AnimeRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AnimeRepository : AbstractRepository<Anime>() {
query.maxResults = 1
query.setParameter("tag", tag)
query.setParameter("hash", hash)
query.uniqueResult()
database.fullInitialize(query.uniqueResult())
}
}

Expand All @@ -33,7 +33,7 @@ class AnimeRepository : AbstractRepository<Anime>() {
query.maxResults = 1
query.setParameter("tag", tag)
query.setParameter("name", name.lowercase())
query.uniqueResult()
database.fullInitialize(query.uniqueResult())
}
}

Expand All @@ -46,7 +46,7 @@ class AnimeRepository : AbstractRepository<Anime>() {
)
query.setParameter("tag", tag)
query.setParameter("name", name.unaccent().lowercase())
query.list()
database.fullInitialize(query.resultList)
}
}

Expand Down Expand Up @@ -136,7 +136,7 @@ class AnimeRepository : AbstractRepository<Anime>() {
Anime::class.java
)
query.setParameter("tag", tag)
query.list()
database.fullInitialize(query.resultList)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class SimulcastRepository : AbstractRepository<Simulcast>() {
val list = database.inTransaction {
val query = it.createQuery("SELECT simulcasts FROM Anime WHERE country.tag = :tag", Simulcast::class.java)
query.setParameter("tag", tag)
query.list()
database.fullInitialize(query.resultList)
}

return list.sortedWith(compareBy({ it.year }, { Constant.seasons.indexOf(it.season) }))
Expand All @@ -19,7 +19,7 @@ class SimulcastRepository : AbstractRepository<Simulcast>() {
val query = it.createQuery("FROM Simulcast WHERE season = :season AND year = :year", Simulcast::class.java)
query.setParameter("season", season)
query.setParameter("year", year)
query.uniqueResult()
database.fullInitialize(query.uniqueResult())
}
}
}

0 comments on commit 8c6ee7a

Please sign in to comment.