List<Object> is a confusing data structure. When iterating through it you will 
need to do instanceof/cast on every entry, and more importantly, you will need 
to know upfront what are the valid entries in there. 

With List<QueryResult> you don't do instanceof/cast, and also if say tomorrow 
we add/change something in the entry format/type, we simply alter QueryResult 
API, making the change visible to the user. 

Andrus


> On Jan 26, 2015, at 6:43 PM, Aristedes Maniatis <a...@maniatis.org> wrote:
> 
> On 26/01/2015 10:26pm, Andrus Adamchik wrote:
>> This form is most generic - it can be a mix of multiple update counts and 
>> result lists. Mostly happens with stored procedures, but in theory can 
>> happen with some multi-statement arbitrary raw SQL:
>> 
>> https://github.com/andrus/cayenne/blob/sqlexec/cayenne-server/src/main/java/org/apache/cayenne/QueryResult.java
> 
> I find this interface very curious. I don't understand what benefit it has 
> over just returning the list of result objects (be they Cayenne entities or a 
> count of results) directly. Can you demonstrate how this interface results in 
> cleaner code for the user?
> 
> Ari
> 
> 
> -- 
> -------------------------->
> Aristedes Maniatis
> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
> 

Reply via email to