Introduce a TransactionTemplate for automating transaction retries.

Changed a flaky test to use the transaction template to avoid unnecessary breakages.
Add query logging.

Three new options added
- dbms.querylog.enabled, if true log queries, defaults to false
- dbms.querylog.filename, the file where queries are logged, defaults to `queries.log`
- dbms.querylog.threshold, only log queries that run slower than threshold (in milliseconds)
  defaults to 0, i.e. log all queries.

 This is an enterprise feature.
Merge pull request #3656 from rickardoberg/retryflaky

Introduce a TransactionTemplate for automating transaction retries
Merge pull request #3661 from pontusmelke/log-queries

Add query logging.