Hi Max,
you can make use of TransactionUtil, see WebToolsService#entityExportAll
for an example.
The main pattern is
// start transaction
boolean beganTx = TransactionUtil.begin();
// iterate through generic values and store them, count numberWritten
...
// commit after 500 values
if (numberWritten % 500 == 0) {
TransactionUtil.commit(beganTx);
beganTx = TransactionUtil.begin();
}
// commit remaining values
TransactionUtil.commit(beganTx);
Hope that helps,
Regards,
Michael Brohl
ecomify GmbH
www.ecomify.de
Am 10.07.17 um 22:47 schrieb Max Peak:
> Greetings all,
>
>
>
> I have a groovy script ( not a service) that collects (scrapes) data,
> processes, and submits to db. If there are too many records, no error is
> thrown but transaction timeout causes no records committed.
>
> Is there a way to call forced commits occasionally during execution to clear
> and reset the transaction queue?
>
>
>
> Thanks a bunch
>
>
>
> Max Peak
>
>
>
>