I am storing json object into Postgresql database table for each insertion or on Submit button using Play Framework and Postgresql. But my requirement is that, I need to create and execute/call one sample batch file to load/save this json object into created batch file on each clicking of Submit button (that is while storing json object into Postgresql database simultaneously). I don't know how to create the batch file for it and call ?(either using triggers or any ?). Please help me and Thanks in advance.
appjson.scala: (which saves submitted json object into database)
case class JsonData (
id: Pk[Long], content: String
)
object JsonData {
val extractor = {
get[Pk[Long]]("jsondata.id") ~
get[String]("jsondata.content") map {
case id~content => JsonData(id, content)
}
}
def save(jsondata: JsonData): Unit = {
DB.withConnection { implicit connection =>
SQL("INSERT INTO jsondata(content) VALUES(CAST({content} AS json))").on(
'content -> jsondata.content
).executeInsert()
}
}
}