加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

scalaquery问题没有隐式会话

发布时间:2020-12-16 19:20:04 所属栏目:安全 来源:网络整理
导读:这是我要执行的 scalaquery查询, ...def generateFares(scheduleId:NamedColumn[Int],toCityId:NamedColumn[Int],fromCityId:NamedColumn[Int]):List[(String,Int,String)] = { var list:List[(String,String)] = Nil; val q = for { tf - ticketingDB.ticke
这是我要执行的 scalaquery查询,

...
def generateFares(scheduleId:NamedColumn[Int],toCityId:NamedColumn[Int],fromCityId:NamedColumn[Int]):List[(String,Int,String)] = {
      var list:List[(String,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

在第二个电话中. (tft<-ticketingDB) 我无法理解scalaquery的这种行为. ps:我可以保证在withSession块中调用该方法. 请帮我调试并创建无错连接.

解决方法

对不起,我发布了解决方案作为评论,

我自己想出了答案.你应该导入threadLocalSession来获取会话对象.

import org.scalaquery.session.Database.threadLocalSession

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读