Optional
stopwatch: StopwatchReadonly
adapterOptional
assignedProtected
Optional
currentReadonly
entityReadonly
eventReadonly
idReadonly
identityProtected
inReadonly
queryCreates a new DatabaseQuery instance which can be used to query and manipulate data.
Readonly
rawProtected
roundsOptional
stopwatchStatic
Readonly
onStatic
Readonly
onStatic
Readonly
onStatic
Readonly
onStatic
Readonly
onStatic
Readonly
onStatic
Readonly
onCommits all open changes (pending inserts, updates, deletions) in optimized batches.
If a transaction is assigned, this will automatically call a transaction commit and the transaction released. Use flush() if you don't want to end the transaction and keep making changes to the current transaction.
Protected
enterCommits all open changes (pending inserts, updates, deletions) in optimized batches.
The transaction (if there is any) is still alive. You can call flush() multiple times in an active transaction. commit() does the same as flush() but also automatically commits and closes the transaction.
Protected
getCreates or returns an existing reference.
If no instance is known in the identity map, it creates a proxy reference (where only primary keys are populated).
You can work with this entity instance to assign new references, but reading for not-hydrated values is not possible.
Writing not-hydrated is possible and lead to a change in the change-detection. Completely hydrate the object using
the hydrateEntity
function.
const user = session.getReference(User, 1);
Executes an async callback inside of a new transaction. If the callback succeeds (not throwing), the session is automatically committed (and thus its transaction committed and all changes flushed). If the callback throws, the session executes rollback() automatically, and the error is rethrown.
await session.transaction(async (session) => {
await session.query(...);
session.add(...);
//...
});
Marks this session as transactional. On the next query or flush/commit() a transaction on the database adapter is started. Use flush(), commit(), and rollback() to control the transaction behavior. All created query objects from this session are running in this transaction as well.
The transaction is released when commit()/rollback is executed. When the transaction is released then this session is not marked as transactional anymore. You have to use useTransaction() again if you want to have a new transaction on this session.
Generated using TypeDoc
When this session belongs to a transaction, then this is set. All connection handlers should make sure that when a query/persistence object requests a connection, it should always be the same for a given transaction. (that's how transaction work). The connection between a transaction and connection should be unlinked when the transaction commits/rollbacks.