Hibernate / EclipseLink Interview questions
What is an EntityManager in EclipseLink?
The EntityManager is the primary JPA interface for interacting with the persistence context: it's used to persist new entities, find existing ones by primary key, execute JPQL or native queries, and manage transaction boundaries in a resource-local setup.
Under the hood, EclipseLink's EntityManager implementation wraps its own native UnitOfWork, EclipseLink's original session-based concept from its TopLink lineage, so JPA-standard calls like persist() and merge() ultimately delegate to that underlying mechanism.
An EntityManager instance is not thread-safe and is meant to be short-lived, typically created per request or per unit of work, and obtained from a thread-safe EntityManagerFactory rather than shared across threads directly.
More Related questions...