8000 Entity `Nothing` is not registered · Issue #67 · sorm/sorm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Aug 31, 2022. It is now read-only.
This repository was archived by the owner on Aug 31, 2022. It is now read-only.
Entity Nothing is not registered #67
Open
@kelebra

Description

@kelebra

Hi, guys,

I am pretty much new to sorm framework and decided to try it because of its API simplicity but unfortunately get this exception during 'fetch by id' operation. Please provide some advice on code below:

  object Database extends Instance(
    entities = Set(Entity[Post]()),
    url = config.getString("db.url"),
    user = config.getString("db.user"),
    password = config.getString("db.password"),
    initMode = if (config.getBoolean("db.init")) InitMode.DropAllCreate else InitMode.DoNothing
  ) {}
import org.h2.tools.Server
import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpec}

class DatabaseSpec extends WordSpec with Matchers with BeforeAndAfterAll {

  "Database" should {

    "provide value by id" in {
      val post = Post("title", "azaza")
      val saved = Database.save(post)
      println(Database.fetchById(saved.id))
    }
  }

  override protected def beforeAll(): Unit = Server.createTcpServer("-tcpAllowOthers").start()
}

Please find full stack trace below:

[info] - should provide value by id *** FAILED ***
[info]   sorm.core.SormException: Entity `Nothing` is not registered
[info]   at sorm.Instance$Api$$anonfun$mapping$1$1.apply(Instance.scala:57)
[info]   at sorm.Instance$Api$$anonfun$mapping$1$1.apply(Instance.scala:57)
[info]   at scala.Option.getOrElse(Option.scala:121)
[info]   at sorm.Instance$Api$class.mapping$1(Instance.scala:56)
[info]   at sorm.Instance$Api$class.sorm$Instance$Api$$mapping(Instance.scala:61)
[info]   at sorm.Instance$Api$$anonfun$fetchById$1$$anonfun$apply$10.apply(Instance.scala:117)
[info]   at sorm.Instance$Api$$anonfun$fetchById$1$$anonfun$apply$10.apply(Instance.scala:117)
[info]   at embrace.package$EmbraceAny$.$$extension(package.scala:6)
[info]   at sorm.Instance$Api$$anonfun$fetchById$1.apply(Instance.scala:117)
[info]   at sorm.Instance$Api$$anonfun$fetchById$1.apply(Instance.scala:116)

Thanks in advance,
Oleksii

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0