Created
October 7, 2014 17:14
-
-
Save zackangelo/61ddde3345b9b1b1999a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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