tiran
tiran

Reputation: 2431

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 {
        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.

Upvotes: 7

Views: 1844

Answers (1)

tiran
tiran

Reputation: 2431

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 

Upvotes: 14

Related Questions