cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Schröder <Peter.Schroe...@freenet-ag.de>
Subject AW: performing count
Date Mon, 04 Jun 2007 06:27:46 GMT
+1 from me 

-----Urspr√ľngliche Nachricht-----
Von: Michael Gentry [mailto:blacknext@gmail.com] 
Gesendet: Freitag, 1. Juni 2007 17:44
An: user@cayenne.apache.org
Betreff: Re: performing count

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

Mime
View raw message