Re: Batch iteration

2016-10-17 Thread Mark Wardle
Thanks Andrus. Mark > On 17 Oct 2016, at 06:28, Andrus Adamchik wrote: > > Hi Mark, > > Scenario B is now the default after a recent change per [1]. We decoupled the > transaction handling open iterator (and all its connections) from any > transactions started by context commits within the i

Re: Batch iteration

2016-10-16 Thread Andrus Adamchik
Hi Mark, Scenario B is now the default after a recent change per [1]. We decoupled the transaction handling open iterator (and all its connections) from any transactions started by context commits within the iterator. Here is a related mailing list thread [2]. Andrus [1] https://issues.apache

Re: Batch iteration

2016-10-16 Thread Mark Wardle
Thanks John. Interestingly, I did some testing and peer contexts aren’t committed until the batch iterator JDBC ResultSet is closed at the end of iteration either. This is fine but for a long running task, I thought that there was a problem (but there wasn’t). I think the only workarounds are a)

Re: Batch iteration

2016-10-15 Thread John Huss
I would use a peer context. You can create a peer context like this if you runtime has been bound to the current thread using CayenneRuntime.bindThreadInjector(runtime.getInjector()) public static ObjectContext newObjectContext() { ObjectContextFactory factory = CayenneRuntime.getThreadInjector (

Re: Batch iteration

2016-10-15 Thread Mark Wardle
Sorry… meant to say using Cayenne M4.0.M3… Mark > On 15 Oct 2016, at 20:29, Mark Wardle wrote: > > I’m using ResultBatchIterator like this: > > Consumer forEach = ... > try (ResultBatchIterator iterator = query.batchIterator(context, > batchSize)) { > for(List batch : it

Batch iteration

2016-10-15 Thread Mark Wardle
I’m using ResultBatchIterator like this: Consumer forEach = ... try (ResultBatchIterator iterator = query.batchIterator(context, batchSize)) { for(List batch : iterator) { for (T c : batch) { forEach.a