mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
No effective change - update Javadoc on QueryIterator with try with resources
This commit is contained in:
@@ -17,8 +17,10 @@ import java.util.Iterator;
|
||||
* </p>
|
||||
* <p>
|
||||
* Remember that with {@link QueryIterator} you must call {@link QueryIterator#close()}
|
||||
* when you have finished iterating the results (typically in a finally block).
|
||||
* when you have finished iterating the results. Use "try with resources" or ensure it
|
||||
* is closed in a finally block.
|
||||
* </p>
|
||||
* <h3>Try finally style</h3>
|
||||
* <pre>{@code
|
||||
*
|
||||
* Query<Customer> query = server.find(Customer.class)
|
||||
@@ -38,6 +40,19 @@ import java.util.Iterator;
|
||||
* }
|
||||
*
|
||||
* }</pre>
|
||||
* <p>
|
||||
* <h3>Try with resources style</h3>
|
||||
* <pre>{@code
|
||||
*
|
||||
* // try with resources
|
||||
* try (QueryIterator<Customer> it = query.findIterate()) {
|
||||
* while (it.hasNext()) {
|
||||
* Customer customer = it.next();
|
||||
* // do something with customer ...
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* }</pre>
|
||||
*
|
||||
* @param <T> the type of entity bean in the iteration
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user