Here's some random feedback ..

I have the need for row counting here and there, so having support in cayenne 
would be great.

Couple things ..

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

I don't see how this works without a DC - ?
(Maybe I'm just missing something obvious ..)


And, for me personally, ..
The notion of "utility" means 'weakly understood' .. so, I try and avoid 
anything for the 'utility' junk box as much as humanly possible.  If it's real, 
and ligit, I try like heck to find a real home (abstraction) where it would 
reside.

Also another personal preference .. I dislike the vague names 'getCount' :-/

If I was reading someone else's  code, I wouldn't mind seeing something like:

    int n = Artist.numberOfRowsMatchingQuery(dc, q);

where q==null counts all.  I think from the OO side of things (which is the 
whole point of ER -> OO), that's really what you're after.

I'd rather make the ~base class support rich - than spread stuff into 'utility' 
classes here and there.

Food for thought.  Dunno if it's even plausible.

2cents.
Thanks,
-Matt


 
On Friday, June 01, 2007, at 11:45AM, "Michael Gentry" <[EMAIL PROTECTED]> 
wrote:
>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