Reputation: 744
I followed the following steps:
sbt new playframework/play-scala-seed.g8
to create new service of Play frameworklibraryDependencies += "org.squeryl" %% "squeryl" % "0.9.14"
to my build.xml file (0.9.14 because that version is compatible with my scala version 2.13.1 as per https://mvnrepository.com/artifact/org.squeryl/squeryl)sbt run
which installed all dependencies. localhost:9000
opens fine without any errors.Added a file MyEntity.scala
with the following content:
import org.squeryl.{KeyedEntity, Schema, Table}
import org.squeryl.annotations.Column
case class MyEntity(
@Column("id") id: Int = 0,
@Column("name") name: String,
) extends KeyedEntity[Int] {
def this() = this(0, "")
}
object MyEntitySchema extends Schema {
val myEntities: Table[MyEntity] = table[MyEntity]("myEntities")
}
Added another file MyEntityRetrieval.scala
with the following content:
import org.squeryl.PrimitiveTypeMode._
import scala.util.Try
class MyEntityRetrieval {
def get(key: Int) : Option[MyEntity] = inTransaction { Try(Some(myEntities.get(key))).getOrElse(None) }
}
sbt run
. No errors. Opened localhost. Showing error: could not find implicit value for parameter fieldMapper: org.squeryl.internals.FieldMapper
.
How do I fix this? Any kind of help would be highly appreciated. Thanks in advance.
Upvotes: 1
Views: 298
Reputation: 507
Try adding the following import to the top of MyEntity.scala
:
import org.squeryl.PrimitiveTypeMode._
Upvotes: 2