A pre-insert identifier generator assigns an entity identifier independently before its SQL INSERT executes. This lets an ORM queue inserts for later execution while still making the identifier available when generation can occur during persist. section 5.2.5
Prefer this strategy when:
- Insert batching matters, because ORM services can delay SQL execution until later in the unit of work. section 5.2.5
- Application code may read the identifier after persist; post-insert mechanisms can leave it null until INSERT completes. section 5.2.5
- Portability matters: enhanced-sequence uses a native database sequence where supported and emulates one with a single-row table otherwise. section 5.2.5
Sequence-backed generation
An enhanced-sequence generator obtains identifiers from a shared, concurrently accessible database sequence before INSERT. Auto-incremented columns, column defaults, and trigger-generated keys instead become available only after INSERT. section 5.2.5
