Reputation: 33317
Using a HQL query like this:
def accounts = Account.executeQuery("select distinct a.number from Account a")
def accountSize = accounts.size()
This gives the accountSize but the problem is that the accounts will be fetched from Hibernate as well. Is there a command that allows to compute the size of the query result without fetching the result?
Upvotes: 0
Views: 482
Reputation: 50285
Account.count()
can give you the total count of rows of Account
table.
Is that what you need?
If you need the HQL, then
def accountSize = Account.executeQuery("select count(distinct a.number) from Account a")
Upvotes: 3