开发者

scalaquery problem no implicit session

this is a scalaquery query which i want to perform,

...
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 {
       开发者_Python百科 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
    }
...

In this join, i'm getting a compilation error:

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

in the second call. (tft <- ticketingDB)

i cannot understand this behavior of scalaquery.

ps: i can assure the method is called inside a withSession block.

please help me to debug and create error free join.


Sorry, I post the solution as a comment,

I figured the answer myself. you should import threadLocalSession to get the session object.

import org.scalaquery.session.Database.threadLocalSession 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜