Fixed inverted onBegin Transaction logic

Use Case: When running against MariaDB the existing case fails because the
onBegin logic is inverted and tries to get a transaction when no
transaction is in progress.