Skip to content

Instantly share code, notes, and snippets.

@wfaler
Created February 23, 2011 22:38
Show Gist options
  • Save wfaler/841349 to your computer and use it in GitHub Desktop.
Save wfaler/841349 to your computer and use it in GitHub Desktop.
SquerylController.scala
class SquerylController extends InterceptingController {
def around(request: Request, response: Response)(controller: (Request, Response) => Unit) = {
val session = SessionFactory.newSession
session.bindToCurrentThread
try{
transaction{
controller(request, response)
}
}finally{
session.close
session.unbindFromCurrentThread
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment