Skip to content

enum Athena::ORM::Mapping::GeneratedValueStrategy #

How the values of an entity's identifier are generated, as set by AORMA::GeneratedValue.

An identifier without an AORMA::GeneratedValue annotation uses NONE.

Members#

AUTO = 0#

Picks the strategy preferred by the database platform, which is currently IDENTITY on every platform.

This is the default when AORMA::GeneratedValue is applied without a strategy.

SEQUENCE = 1#

Generates values from a database sequence.

Todo

Not supported yet; building the metadata of an entity using it raises.

IDENTITY = 2#

The database generates the value when the row is inserted, e.g. via an auto increment or identity column.

On platforms supporting RETURNING (PostgreSQL, SQLite, MariaDB), the generated values are read back from the INSERT statement itself, which also allows composite identifiers whose columns are all generated. Otherwise (MySQL) the value is read back via the last insert ID, which only supports a single identifier column. Either way, the identifier is available on the entity once AORM::EntityManager#flush has inserted it.

NONE = 3#

The identifier values are assigned by your code, and must be set before the entity is passed to AORM::EntityManager#persist.

CUSTOM = 4#

Generates values via a custom generator.

Todo

Not supported yet; building the metadata of an entity using it raises.

Methods#

#auto?#

Returns true if this enum value equals AUTO

View source

#custom?#

Returns true if this enum value equals CUSTOM

View source

#identity?#

Returns true if this enum value equals IDENTITY

View source

#none?#

Returns true if this enum value equals NONE

View source

#sequence?#

Returns true if this enum value equals SEQUENCE

View source