EntityManagerFactory
classin packageklyn.data
public final class EntityManagerFactory implements AutoClosable
EntityManagerFactory
All Implemented Interfaces: AutoClosable

Thread-safe factory for short-lived EntityManager instances.

The factory owns immutable provider configuration and mapping metadata. It performs no connection I/O until a manager actually executes provider work.

try factory = EntityManagerFactory(configuration, entities=[User]):
    try manager = factory.createEntityManager():
        users = manager.repository<User, Int>()
Properties
Modifier and Type Member Description
public readonly property mappedTypes
mappedTypes as IList<Type>
Complete immutable entity model captured when this factory was acquired.
public readonly property open
open as Boolean
Indicates whether new managers can still be created.
public readonly property schema
schema as SchemaManager
Thread-safe schema manager bound to this factory's immutable entity model.
Constructors
Modifier and Type Member Description
public EntityManagerFactory
EntityManagerFactory( configuration as ProviderConfiguration, entities as IList<Type>, mappings as MappingRegistry = MappingRegistry.empty, policies as IList<EntityPolicyRegistration> = [], policyContext as PolicyContext = PolicyContext.empty )
Creates a factory over immutable provider and mapping configuration.
Methods
Modifier and Type Member Description
public close
close() as Void
Rejects future manager creation.
public createEntityManager
createEntityManager() as EntityManager
Creates one independent, non-thread-safe persistence context.
Inherited Methods
methodInherited Methods from AutoClosable: close