1

I followed the following steps:

  • Ran sbt new playframework/play-scala-seed.g8 to create new service of Play framework
  • Added the line libraryDependencies += "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)
  • ran 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.

  • Searched in Google. Didn't find anything useful.

How do I fix this? Any kind of help would be highly appreciated. Thanks in advance.

Sanjiban Bairagya
  • 704
  • 2
  • 12
  • 33

1 Answers1

2

Try adding the following import to the top of MyEntity.scala:

import org.squeryl.PrimitiveTypeMode._
Regan Koopmans
  • 451
  • 6
  • 16