Personally, i would suggest the use of count() instead of size.
Because count() will get the count while querying the database,
on the other hand, size() will load the entities and then return their size, because there is no such thing as size in the db.
since you only need the number of rows, better get them from the db instead of getting from
java.