Solved it myself.

I set the service to manual transaction (use-transaction="N") and set 
TransactionUtil.begin() at the beginning and TransactionUtil.commit() at the 
end of every loop.

Cheers,
Ingo

-----Ursprüngliche Nachricht-----
Von: Ingo Wolfmayr <[email protected]> 
Gesendet: Mittwoch, 20. September 2023 08:30
An: [email protected]
Betreff: Transaction

Hi everybody,

I have a question regarding transaction:

I have a service that parses a big file and creates products from it. > 100.000 
products

If I do a TransactionUtil.commit() after each product, do I have to add a 
TransactionUtil.begin() for the next loop?

- Service starts and creates a transaction
- Product 1 --> commit
- Product 2 --> commit

or should I disable the service transaction via use-transaction="N"

- Service starts - no transaction
- begin --> Product 1 --> commit
- begin --> Product 2 --> commit

The goal is to reduce memory consumption.

Best regards,
Ingo

Reply via email to