> On Apr 8, 2015, at 4:24 AM, Aristedes Maniatis <a...@maniatis.org> wrote: > > Although it looks really cool, I worry that this is taking us too far away > from Cayenne's true purpose. Personally I'm -1 on all the iterator methods. > There are plenty of libraries that already do all that, and probably better > than us (more choices, flexibility, users, testing). > > http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/Lists.html#partition%28java.util.List,%20int%29 > > https://commons.apache.org/proper/commons-collections/javadocs/api-3.2.1/index.html?org/apache/commons/collections/IteratorUtils.html > > > Am I missing the point here of why these should be in an ORM?
John already commented on this. Iterators are backed by open ResultSets and are for constant-memory operations to process unlimited stream of DB data. This is where batch iterator comes from - it is useful in jobs that processing incoming data stream in chunks and commit the context after each chunk. > Personally if we are going to add more convenience functions I'd rather see > query.count(), query.sum(Article.PRICE), etc aggregate functions. IMO "tail methods" should not be mixed with methods that belong in the query DSL. Tail methods do not alter the query. To them the query is opaque. They control the shape of the result, not generated SQL. In other words, unless we implement "count" as 'list.size()', "count" definition should be a part of the query DSL, and does not belong in a tail method. Andrus