You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm new to scala and I'm trying to integrate a PostgreSQL database to a Lagom application written in scala.I'm trying to utilise the persistence API of Lagom. Lagom has inbuilt support for slick.
My table has 3 fields id of type int, name of type string, data of type jsonb
Since Slick doesn't support json format I'm trying to use slick-pg .
Below is my implementation
My custom profile class
import com.github.tminglei.slickpg.{ExPostgresProfile, PgPlayJsonSupport}
import play.api.libs.json.JsValue
import slick.basic.Capability
import slick.jdbc.{JdbcCapabilities, PostgresProfile}
trait CustomPostgresProfile extends ExPostgresProfile with PgPlayJsonSupport {
def pgjson = "jsonb"
override protected def computeCapabilities: Set[Capability] =
super.computeCapabilities + JdbcCapabilities.insertOrUpdate
override val api = PostgresJsonSupportAPI
object PostgresJsonSupportAPI extends API with JsonImplicits {}
}
object CustomPostgresProfile extends PostgresProfile
My table definition
import com.custom.persistence.profile.CustomPostgresProfile.api._
import play.api.libs.json._
case class CustomDataEntity(id:int,name: String, data: JsValue)
object CustomDataTableDef {
val data = TableQuery[CustomDataTableDef]
}
class CustomDataTableDef(tag: Tag) extends Table[CustomDataEntity](tag, "custom"){
def id = column[Int]("id", O.PrimaryKey)
def name = column[String]("name")
def data = column[JsValue]("data")
override def * =
(id,name,data) <> (CustomDataEntity.tupled,CustomDataEntity.unapply(_))
}
when I'm trying to compile the code, I get the below 2 errors
could not find implicit value for parameter tt: slick.ast.TypedType[play.api.libs.json.JsValue]
[error] def data = column[JsValue]("data")
Cannot resolve symbol <>
Please help me to resolve this
Thanks in advance
The text was updated successfully, but these errors were encountered:
I'm new to scala and I'm trying to integrate a PostgreSQL database to a Lagom application written in scala.I'm trying to utilise the persistence API of Lagom. Lagom has inbuilt support for slick.
My table has 3 fields id of type int, name of type string, data of type jsonb
Since Slick doesn't support json format I'm trying to use slick-pg .
Below is my implementation
My custom profile class
My table definition
when I'm trying to compile the code, I get the below 2 errors
Please help me to resolve this
Thanks in advance
The text was updated successfully, but these errors were encountered: