Beans and DB-transactions?

is there a way to combine the usage of beans and database transactions? I have data imports which writes to multiple tables and each set should be stored together or not at all. I know I can do that in raw-sql but is it possible to keep using beans and the ->add() calls for adding relationships?

I am using SuiteCRM 7.11 on a MySQL DB backend in case that matters.

In PHP you can catch exceptions if something goes wrong, and undo the previous database writes by deleting rows.

Do be honest, I am trying to circumvent commits after each single record. I rather would commit after every set to save computation time. There is no way to switch into a transaction mode when using beans ?

There is no transaction mode, no. But if you’re going to use SQL transactions you might as well use SQL INSERTs too, it won’t add too much work, I guess.