Use manaual sql-transaction to prevent deadlocks

Also select the forUpdate on the base table, instead of the version
table. Using the version table will result in more deadlocks (due to
inserts instead of updates).
Merge pull request #2 from Recras/auditlogTransaction

Use manaual sql-transaction to prevent deadlocks