Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 818
tiran Avatar asked Sep 19 '11 09:09

tiran


1 Answers

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 
like image 95
tiran Avatar answered Sep 19 '22 16:09

tiran