2011-09-19 10 views
7

esta es una consulta scalaquery que quiero realizar,problema scalaquery ninguna sesión implícita

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

En este unirse, estoy recibiendo un error de compilación:

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

en la segunda llamada. (tft < - ticketingDB)

no puedo entender este comportamiento de scalaquery.

ps: puedo asegurar que el método se llama dentro de un bloque withSession.

por favor ayúdame a eliminar errores y crear uniones sin errores.

+0

siento molestarlos, pero me di cuenta de la solución. No había importado threadLocalSession al archivo. import org.scalaquery.session.Database.threadLocalSession – tiran

+0

si encuentra la respuesta por su cuenta, publíquela como respuesta. – geowa4

Respuesta

14

Lo sentimos, he puesto la solución como un comentario,

pensé que la respuesta a mí mismo. deberías importar threadLocalSession para obtener el objeto de la sesión.

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

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

+0

Slick 2.0 requiere una importación diferente: http://slick.typesafe.com/doc/2.0.0/migration.html#dynamically-and-statically- scoped-sessions – rhodri

Cuestiones relacionadas