mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
FIX: Recursive batch flush can save dependant beans in wrong order
This commit is contained in:
committed by
Roland Praml
parent
83e87b0c67
commit
d3427876b7
@@ -224,14 +224,21 @@ public final class BatchControl {
|
||||
* Execute all the requests contained in the list.
|
||||
*/
|
||||
void executeNow(ArrayList<PersistRequest> list) throws BatchedSqlException {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (i % batchSize == 0) {
|
||||
// hit the batch size so flush
|
||||
flushPstmtHolder();
|
||||
boolean old = transaction.isFlushOnQuery();
|
||||
transaction.setFlushOnQuery(false);
|
||||
// disable flush on query due transsaction callbacks
|
||||
try {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (i % batchSize == 0) {
|
||||
// hit the batch size so flush
|
||||
flushPstmtHolder();
|
||||
}
|
||||
list.get(i).executeNow();
|
||||
}
|
||||
list.get(i).executeNow();
|
||||
flushPstmtHolder();
|
||||
} finally {
|
||||
transaction.setFlushOnQuery(old);
|
||||
}
|
||||
flushPstmtHolder();
|
||||
}
|
||||
|
||||
public void flushOnCommit() throws BatchedSqlException {
|
||||
|
||||
Reference in New Issue
Block a user