Search code examples
scalasorm

How to add Scala Enumeration in SORM?


How add enums in SORM?

I have this enumeration:

object RoutineType extends Enumeration {
  val TimeRoutine, SetRoutine = Value
}

and in DB object I add entity:

entities = Set() + Entity[RoutineType.Value]()

but when I load everything I get this exception:

Caused by: sorm.core.SormException: Unsupported type: Enumeration

Why? Documentation tells enums are supported


Solution

  • SORM only needs you to register case classes as entities with it. You shouldn't do this with enums.

    Concerning your problems with Play Framework, they may be caused by incompatibility with Play 2.2. SORM only supports Play 2.1 for now.