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.

Thoughts?

/dev/mrg

Reply via email to