package sorm

  1. Public
  2. All

Type Members

  1. sealed case class Entity(reflection: Reflection, indexed: Set[Seq[String]], unique: Set[Seq[String]]) extends Product with Serializable

  2. sealed trait InitMode extends AnyRef

    A mode for initialization performed when a connection to db gets established on creation of a SORM instance.

  3. class Instance extends Initialization with Api

    The instance of SORM

  4. trait Persisted extends AnyRef

    All the entities returned from SORM have a Persisted trait with an appropriate value of id mixed in.

    Persisted trait and ids

    All the entities returned from SORM have a Persisted trait with an appropriate value of id mixed in. This is what lets SORM decide whether to INSERT rows or UPDATE them (and which ones) when the save operation is called. This also provides you with access to its generated id. Since the id property value is meant to be generated by database, it is protected from the user of being able to manually specify it as well as letting the case classes have such a property. So, instead of

    case class Artist ( id : Long, name : String )

    you should use

    case class Artist ( name : String )

    and let SORM take care of id property management for you.

    What should you do when you need to get an id of an entity?

    Just do

    but for you to be able to do that the artist value must have a Persisted trait mixed in (i.e., have a type Artist with Persisted), which can happen only in three cases: When you store a value in the db:

    val artist ="Metallica"))

    When you fetch it from the db:

    val artist = Db.query[Artist].whereEqual("name", "Metallica").fetchOne().get

    When you make a copy of an already persisted entity:

    val artist = someOtherPersistedArtist.copy(name = "METALLICA")
  5. class Querier[T <: AnyRef] extends AnyRef

Value Members

  1. object Dsl

  2. object Entity extends Serializable

  3. object InitMode

  4. object Instance

  5. object Querier

  6. package abstractSql

  7. package core

  8. package ddl

  9. package driver

  10. package jdbc

  11. package joda

  12. package mappings

  13. package persisted

  14. package pooling

  15. package query

  16. package reflection

  17. package sql

  18. package tableSorters