Created
February 16, 2011 00:15
-
-
Save wfaler/828574 to your computer and use it in GitHub Desktop.
intercepting.scala
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
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