Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. trait ThreadMountedScalaQuerySession extends ScalaQuerySession {
  2.   private val sessionDynamicVariable = new DynamicVariable[Option[Session]](None)
  3.   override def session = sessionDynamicVariable.value.get
  4.   override def intent = {
  5.     case req =>
  6.       ProductDb.database withSession {
  7.         session => sessionDynamicVariable.withValue(Some(session)) {
  8.           super.intent(req)
  9.         }
  10.       }
  11.   }
  12. }