Question

I am a newbie with scala, play and anorm. Trying to figure out.

Right now I created a case class like ;

case class Company(
             var id: Pk[Long] ,
             var name: String,
             var appid: String,
             var appSecret: String,
             var iban: String) 

I can create dummy object to insert like this;

var c: Company  = Company(anorm.NotAssigned,"Test Inc","test123456","4506xk23iosc44545","TR324349999000342")

But I can't populate a dummy object with id field (later i'll use it to update model)

When I type

var c: Company  = Company(7,"Test Inc","test123456","4506xk23iosc44545","TR324349999000342")

I got error that saying type mismatch; found : Int(7) required: anorm.Pk[Long]

How can i solve it?

Was it helpful?

Solution

Pk has two subclasses NotAssigned and Id which is when it has got a value, so Id(7)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top