Skip to content

Instantly share code, notes, and snippets.

@eishay
Created May 2, 2016 22:52
Show Gist options
  • Save eishay/11d8635392156f72fee21018e1ff4e53 to your computer and use it in GitHub Desktop.
Save eishay/11d8635392156f72fee21018e1ff4e53 to your computer and use it in GitHub Desktop.
db.readOnly { implicit s =>
// only reading from db - not in a transaction
}
db.readWrite { implicit s =>
// reading and writing to db in a transaction
}
db.readWrite(3) { implicit s =>
// reading and writing to db in a transaction with retries if a database
// exception is thrown (up to 3 attempts total) by rolling back the
// transaction, starting a new one, and re-executing the block.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment