cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Gentry" <>
Subject Re: performing count
Date Fri, 01 Jun 2007 15:44:11 GMT
Looking at that CountQuery class makes me think we should actually add it to
Cayenne as a utility class.  Perhaps with two additional methods added:

public int getCount();
public int getCount(DataContext dc);

That way you could then do:

CountQuery query = new CountQuery(Artist.class);
int rowCount = query.getCount();

or even:

int rowCount = new CountQuery(Artist.class).getCount();

I think that would simplify things and needing a count is a pretty comment
activity.  Perhaps for more flexibility, it would be good to have a
constructor that could take a WHERE clause, too, in case you only need
counts matching certain criteria.



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message