Google News
logo
JPA - Interview Questions
What is EntityManager and what are its main functions you can list?
EntityManager is an interface that describes an API for all basic operations on Enitity, data retrieval and other JPA entities. Essentially the main API for working with JPA. Basic operations :
 
* For operations on Entity : persist (adding Entity under JPA control), merge (updating), remove (delete), refresh (updating data), detach (removing from management JPA), lock (blocking Enity from changes in other thread),
 
* data Preparation : find (search and retrieval entity), createQuery, createNamedQuery, createNativeQuery , contains, createNamedStoredProcedureQuery, createStoredProcedureQuery
 
* Preparation of other entities JPA : getTransaction, getEntityManagerFactory, getCriteriaBuilder, getMetamodel, getDelegate
 
* Work with EntityGraph : createEntityGraph, getEntityGraph
 
* General operations on EntityManager or all Entities : close, isOpen, getProperties, setProperty, clear.
Advertisement