cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Savva Kolbachev (JIRA)" <>
Subject [jira] [Created] (CAY-1995) Improve Select queries API
Date Wed, 01 Apr 2015 09:19:52 GMT
Savva Kolbachev created CAY-1995:

             Summary: Improve Select queries API
                 Key: CAY-1995
             Project: Cayenne
          Issue Type: Improvement
            Reporter: Savva Kolbachev
            Assignee: Savva Kolbachev
             Fix For: 4.0.M3

There are some improvements which we want to apply:

*1. To make ResultIterator extending;*

It is important for those, who uses Java 1.7 and higher, because interface
extends java.lang.AutoCloseable. So users will be able to use try-with-resources.

*2. Add next methods to interface Select<T>:*

     * Selects objects using provided context. 
     * Essentially the inversion of "".
    <T> List<T> select(ObjectContext context);

     * Selects a single object using provided context. The query is expected to
     * match zero or one object. It returns null if no objects were matched. If
     * query matched more than one object, org.apache.cayenne.CayenneRuntimeException is
     * thrown.
     * Essentially the inversion of "ObjectContext.selectOne(Select)".
    <T> T selectOne(ObjectContext context);

     * Creates a ResultIterator based on the provided context and passes it to a
     * callback for processing. The caller does not need to worry about closing
     * the iterator. This method takes care of it.
     * Essentially the inversion of "ObjectContext.iterate(Select, ResultIteratorCallback)".
    <T> void iterate(ObjectContext context, ResultIteratorCallback<T> callback);

     * Creates a ResultIterator based on the provided context. It is usually
     * backed by an open result set and is useful for processing of large data
     * sets, preserving a constant memory footprint. The caller must wrap
     * iteration in try/finally (or try-with-resources for Java 1.7 and higher) and close
the ResultIterator explicitly.
     * Essentially the inversion of "ObjectContext.iterator(Select)".
    <T> ResultIterator<T> iterator(ObjectContext context);

*3. Investigate Java 8 Streams API and how it works with Iterable;*

*4. Discuss and apply micro-batches.*

This message was sent by Atlassian JIRA

View raw message