SQL script cause database to lock block

If you are not using Ignition to create the transaction, then Ignition will not be able to rollback the transaction. Don't do this. Create the transaction in ignition with the rollback/commit logic in Ignition, or do it in a stored procedure if you want it to be purely handled by the DB. Don't do it in both places.

You said you are using system.db.beginNamedQueryTransaction() if that is the case, then you are effectively wrapping a transaction with a transaction (not good).

Multiple queries inside of a named query is just asking for trouble (Even if it works currently). On top of that it makes it difficult to troubleshoot should it come to that. Split them out completely. If for some reason you insist on multiple statements being executed in one call then you should use a stored procedure.

Use java.lang.Throwable to catch errors.

1 Like