org.positronicnet.orm

ManagedRecord

trait ManagedRecord extends AnyRef

Abstract base class for objects that will be persisted by this ORM into some ContentRepository (be it a Database, a ContentProvider, or whatever).

As you can see, the infrastructure present in class instances is deliberately kept very minimal. (The usual convention is to use immutable classes for these; that means that copying has to be fast, and copies very lightweight.) The main machinery here is to implement certain conventions regarding id fields, and to allow associations to be declared. (It is strongly recommended that they be declared as lazy vals, again to avoid overhead on construction or copying unless and until the association object will actually be used.)

Most of the heavy lifting is delegated to a RecordManager. As discussed in the orm overview, the usual pattern is to have ManagedRecord subclasses pass a suitable RecordManager singleton into the ManagedRecord superclass constructor, like so:

    case class TodoItem( description: String    = null,
                         isDone: Boolean        = false,
                         id: RecordId[TodoItem] = TodoItems.unsavedId
                       )
      extends ManagedRecord( TodoItem )

    object TodoItems extends RecordManager[TodoItem]( TodoDb("todo_items"))

It's also possible to use a BaseRecordManager; the difference between this and the more ordinary kind of RecordManager is that a RecordManager will automatically map fields based on certain naming conventions, while a org.positonicnet.orm.BaseRecordManager must be configured explicitly.

Note also that the manager MUST be a RecordManager[ thisclass ], (or BaseRecordManager[ thisclass ]), but it's awfully awkward to write that constraint...

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. ManagedRecord
  2. AnyRef
  3. Any
Visibility
  1. Public
  2. All

Type Members

  1. class HasMany [T <: ManagedRecord] extends HasManyAssociation[T]

    One-to-many association.

Abstract Value Members

  1. val id : org.positronicnet.orm.RecordId[_]

    Persistent ID of this record.

    Persistent ID of this record. Must default to ManagedRecord.unsavedId in unsaved instances constructed by the no-arguments (or all-defaulted-arguments constructor) of an ManagedRecord subclass, or in the objects constructed by the newRecord method of the RecordManager, if that is overridden.

    Attributes
    abstract

Concrete Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  5. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  6. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  7. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  8. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  9. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  11. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef
  12. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  13. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  14. def isNewRecord : Boolean

    True if this is a new record (i.

    True if this is a new record (i.e., not a query result).

  15. def isUnsaved : Boolean

    True if this record is unsaved (i.

    True if this record is unsaved (i.e., a new record or modified query result).

  16. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  17. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  18. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  19. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  20. def toString (): String

    Definition Classes
    AnyRef → Any
  21. def wait (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  22. def wait (arg0: Long, arg1: Int): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  23. def wait (arg0: Long): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from AnyRef

Inherited from Any