2011-09-19 2 views
7

이 내가 수행하고자하는 scalaquery 쿼리를하고,이 결합에서scalaquery 문제 암시 세션

... 
def generateFares(scheduleId:NamedColumn[Int], toCityId:NamedColumn[Int], fromCityId:NamedColumn[Int]):List[(String,Int,String)] = { 
     var list:List[(String,Int,String)] = Nil; 
     val q = for { 
     tf <- ticketingDB.ticketFares if ((tf.scheduleId is scheduleId) && (tf.fromCityId is fromCityId) && (tf.toCityId is toCityId)) 
     tft <- ticketingDB.ticketFareType if tft.id is tf._7 
     }{ 
     list = (tft._2, tf._5, tf._6)::list 
     } 
     list 
    } 
... 

, 내가 컴파일 오류를 받고 있어요 : 두 번째 통화에

could not find implicit value for parameter session: org.scalaquery.session.Session 

. < - ticketingDB)

이 스칼라 쿼리의 동작을 이해할 수 없습니다.

ps : 메소드가 withSession 블록 내부에서 호출되도록 할 수 있습니다.

디버깅을 도와주세요. 오류가없는 가입을 만드십시오. 죄송합니다

+0

불편을 끼쳐 드려 죄송 합니다만, 해결책을 찾았습니다. 나는 파일에 threadLocalSession을 가져 오지 않았다. import org.scalaquery.session.Database.threadLocalSession – tiran

+0

독자가 대답을 찾아 내면 대답으로 게시하십시오. – geowa4

답변

14

, 나는

내가 대답 나 자신을 생각, 주석으로 솔루션을 게시 할 수 있습니다. threadLocalSession을 가져 와서 세션 객체를 가져와야합니다.

import org.scalaquery.session.Database.threadLocalSession 
+3

slick :'import scala.slick.session.Database.threadLocalSession' – lreeder

+0

Slick 2.0은 다른 가져 오기가 필요합니다 : http://slick.typesafe.com/doc/2.0.0/migration.html#dynamically-and-statically- 범위가 지정된 세션 – rhodri