Aller au contenu

Count Vs Exists (ARCH8063)

Ce contenu n’est pas encore disponible dans votre langue.

Key kotlin.orm.count-vs-exists · Severity info · Category orm

Flags count() > 0 or findAll().size checks used only to test presence - the database can stop at the first row with exists.

if (repo.count() > 0)
if (repo.existsById(id))

Use exists / existsBy / LIMIT 1 for presence checks.