Skip to content

Instantly share code, notes, and snippets.

@zackangelo
Created October 7, 2014 17:14
Show Gist options
  • Save zackangelo/61ddde3345b9b1b1999a to your computer and use it in GitHub Desktop.
Save zackangelo/61ddde3345b9b1b1999a to your computer and use it in GitHub Desktop.
//One of these will make for a very bad day... Can you tell which one?
import scala.slick.session.Database
val db:Database = _ //connection pool (e.g., c3p0)
//Option A
def fetchResultsA = future {
db.withSession { implicit session =>
val query = for (c <- coffees) yield c.name
query.list()
}
}
//Option B
def fetchResultsB = db.withSession { implicit session =>
future {
val query = for (c <- coffees) yield c.name
query.list()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment