Last active
August 29, 2015 14:04
-
-
Save j14159/6aee8831ffb10747f226 to your computer and use it in GitHub Desktop.
This file contains 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
case class Person(name: String, email: String) | |
case class PersonById(id: Int) | |
class PersonDao(cf: () => Connection) extends Actor { | |
lazy val conn = cf() | |
override def preRestart(why: Throwable, msg: Option[Any]): Unit = | |
try { conn.close() } | |
def receive = { | |
case Person(n, e) => | |
//call insert function with above connection | |
sender ! 1 // mock person ID | |
case PersonById(id) => | |
//get person from connection above | |
sender ! Person("name", "email") // mock | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment