如何解决光滑没有找到匹配的形状
case class supplier(id:Int,name:String,street:String,city:String,state: String,zip:String)
class suppliers(tag: Tag) extends Table[supplier](tag,"suppliers") {
def id = column[Int]("ID",O.PrimaryKey)// This is the primary key column
def name = column[String]("Name")
def street = column[String]("Street")
def city = column[String]("City")
def state = column[String]("State")
def zip = column[String]("Zip")
override def * = (id,name,street,city,state,zip) <> ((supplier.apply _).tupled,supplier.unapply)
}
val suppliers = TableQuery[suppliers]
case class Coffee(name:String,supID:Int,price:Double,sales:Int,total:Int)
class Coffees(tag: Tag) extends Table[Coffee](tag,"Coffees") {
def name = column[String]("Name",O.PrimaryKey)
def supID = column[Int]("Sup_ID")
def price = column[Double]("Price")
def sales = column[Int]("Sales")
def total = column[Int]("Total")
def * = (name,supID,price,sales,total) <> ((Coffee.apply _).tupled,Coffee.unapply)
def supplier = foreignKey("Sup_FK",suppliers)(_.id)
}
val coffees = TableQuery[Coffees]
这些是表定义,我想进行联接查询
val manualJoin = for {
c <- coffees if c.price < 9.0
s <- suppliers if s.id===c.supID
} yield (c.name,s.name)
但是它给出了下面的错误
No matching Shape found.
Slick does not kNow how to map the given types.
Possible causes: T in Table[T] does not match your * projection,you use an unsupported type in a Query (e.g. scala List),or you forgot to import a driver api into scope.
required level: slick.lifted.FlatShapeLevel
Source type: (slick.lifted.Rep[String],slick.lifted.Rep[String])
Unpacked type: T
Packed type: G
s <- suppliers if s.id===c.supID
我不知道该如何解决。有人可以解释一下是什么问题吗?
这些是进口
import slick.jdbc.MysqLProfile.api._
import scala.concurrent.ExecutionContext.Implicits.global
import slick.ast.ScalaBaseType.stringType
import scala.concurrent.Await
import scala.concurrent.duration.Duration
解决方法
删除import slick.ast.ScalaBaseType.stringType
行。我怀疑这会在范围内引入不明确的隐式。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。