One-to-many association.
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.
True if this is a new record (i.
True if this is a new record (i.e., not a query result).
True if this record is unsaved (i.
True if this record is unsaved (i.e., a new record or modified query result).
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 aslazy val
s, 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:
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 ]
, (orBaseRecordManager[ thisclass ]
), but it's awfully awkward to write that constraint...