Skip to content

Instantly share code, notes, and snippets.

@wfaler
Created February 16, 2011 00:15
Show Gist options
  • Save wfaler/828574 to your computer and use it in GitHub Desktop.
Save wfaler/828574 to your computer and use it in GitHub Desktop.
intercepting.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
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment