How to test if a table is empty, using Hibernate
Posted
by landon9720
on Stack Overflow
See other posts from Stack Overflow
or by landon9720
Published on 2010-05-28T21:21:30Z
Indexed on
2010/05/28
21:32 UTC
Read the original article
Hit count: 155
hibernate
Using Hibernate, what is the most efficient way to determine if a table is empty or non-empty? In other words, does the table have 0, or more than 0 rows?
I could execute the HQL query select count(*) from tablename
and then check if result is 0 or non-0, but this isn't optimal as I would be asking the database for more detail than I really need.
© Stack Overflow or respective owner