public final class EntityManager implements AutoClosable, QuerySynchronizer, SQLIdentityTracker:
Non-thread-safe persistence context for queries and entity lifecycle.
Repository<T, TId> is only a typed KQL query root. Key lookup, persistence, merging and removal are centralized here so every provider observes one identity map and one unit-of-work boundary.
try factory = EntityManagerFactory(configuration): try manager = factory.createEntityManager(): users = manager.repository<User>() user = manager.find<User>(1)
| Modifier and Type | Member | Description |
|---|---|---|
| public property | flushModeflushMode as FlushMode: |
Controls synchronization before query execution. |
| public readonly property | openopen as Boolean: |
Indicates whether this persistence context accepts operations. |
| public readonly property | transactiontransaction as EntityTransaction |
Transaction bound to this manager's provider session. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | EntityManagerEntityManager(
configuration as ProviderConfiguration,
mappings as MappingRegistry = MappingRegistry.empty
): |
Creates a persistence context for one provider configuration. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | beforeQuerybeforeQuery() as Void: |
Flushes pending changes before managed query I/O in AUTO mode. |
| public | closeclose() as Void: |
Closes the provider session and invalidates manager-owned repositories. |
| public | findfind<T, TId>(id as TId) as T: |
Finds an entity by its mapped identity. |
| public | mergemerge<T>(entity as T) as T: |
Copies detached state into a managed instance. |
| public | persistpersist<T>(entity as T) as Void: |
Registers a new entity for insertion. |
| public | removeremove<T>(entity as T) as Void: |
Registers a managed entity for deletion. |
| public | repositoryrepository<T, TId>(
mapping as MappingDescriptor<T, TId>
) as Repository<T, TId>: |
Returns a cached typed KQL query root using an explicit mapping. |
| public | repositoryrepository<T, TId>() as Repository<T, TId>: |
Returns a cached typed KQL query root using the default mapping. |
| public | saveChangessaveChanges() as Int: |
Synchronizes pending unit-of-work changes with the provider. |
| public | trackSQLtrackSQL(entity as Object, mapping as SQLMappedEntity) as Object: |
Resolves a materialized SQL entity through this manager's identity map. |