fwbrasil / activate

Abandoned: Pluggable persistence in Scala
GNU Lesser General Public License v2.1
299 stars 46 forks source link

Create Entity error "Can't find a id generator for class" I'm using EntityWithCustomID #131

Closed avramirez closed 10 years ago

avramirez commented 10 years ago

Hi I have this case class that extends to entityWithCustomId

  case class Subscription(
    val id: String, 
    var name:String
    ) extends EntityWithCustomID[String]

When I'm using byId it works.

transactional{ byId[Subscription]("sampleId1") }

But when I try creating one it gives me this error:

transactional{
subscription:Subscription=Subscription("sampleId2","Sample Name2") 
subscription.toMap.createEntity
}
Can't find a id generator for class Subscription.

But when I'm using a normal extends Entity it works.

fwbrasil commented 10 years ago

@avramirez I tried to reproduce the error without success using the example project:

https://github.com/fwbrasil/activate-example/commit/294be947f35ec0f729bedbc195718d139275e6fc

Could you provide a sbt project reproducing the issue? You can use the activate-example if it makes easier.

kry00la commented 10 years ago

@fwbrasil Hi, i encounter the same issue with activate-spray and successfully re-create the scenario also this are changes that i made in the activate-example repo

https://gist.github.com/xleeled/8eec931d47222b43e25c

fwbrasil commented 10 years ago

Thanks for the example, it reproduces the issue. I'm working on the fix.

fwbrasil commented 10 years ago

fixed along with #158

kry00la commented 10 years ago

I also have the same fix locally and planning to have a pull request, Thanks btw