A new entity object needs
a new id, and the database is holding all the old rows, so it is the proper agent to assign it
Note this can’t be done
with standard SQL insert, which needs predetermined values for all columns
Every production database has a SQL extension to
do this
◦Oracle’s sequences
◦SQL Server’s auto-increment
datatype
◦…
The ORM system coordinates
with the database to assign the id, in effect standardizing an extension of SQL
Keys obtained this way
have no meaning, are called “surrogate keys”
Natural keys can be used instead if they are
available.