Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait ThreadMountedScalaQuerySession extends ScalaQuerySession {
- private val sessionDynamicVariable = new DynamicVariable[Option[Session]](None)
- override def session = sessionDynamicVariable.value.get
- override def intent = {
- case req =>
- ProductDb.database withSession {
- session => sessionDynamicVariable.withValue(Some(session)) {
- super.intent(req)
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement