Skip to content

Commit bcc0e9d

Browse files
committed
Deprecated hasRecords, added isEmpty and isNotEmpty and fixed performance issues with them by setting limit(1)
1 parent 6aacf97 commit bcc0e9d

File tree

1 file changed

+10
-1
lines changed
  • src/main/java/org/javawebstack/orm/query

1 file changed

+10
-1
lines changed

src/main/java/org/javawebstack/orm/query/Query.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,17 @@ public int count() {
464464
}
465465
}
466466

467+
@Deprecated
467468
public boolean hasRecords() {
468-
return count() > 0;
469+
return isNotEmpty();
470+
}
471+
472+
public boolean isNotEmpty() {
473+
return limit(1).count() > 0;
474+
}
475+
476+
public boolean isEmpty() {
477+
return !isNotEmpty();
469478
}
470479

471480
}

0 commit comments

Comments
 (0)