public interface EntityManager
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the context, causing all entities to become detached.
|
void |
close()
Closes the entity manager.
|
boolean |
contains(java.lang.Object entity)
Check if the instance belongs to the current context.
|
Query |
createNamedQuery(java.lang.String name)
Creates a named query.
|
<T> TypedQuery<T> |
createNamedQuery(java.lang.String name,
java.lang.Class<T> resultClass)
Creates a named query.
|
Query |
createNativeQuery(java.lang.String sql)
Creates a native SQL query.
|
Query |
createNativeQuery(java.lang.String sql,
java.lang.Class resultClass)
Creates a native SQL query.
|
Query |
createNativeQuery(java.lang.String sql,
java.lang.String resultSetMapping)
Creates a query for SQL.
|
<T> TypedQuery<T> |
createQuery(CriteriaQuery<T> criteriaQuery)
Creates a TypedQuery for a criteria
|
Query |
createQuery(java.lang.String ql)
Creates a new query.
|
<T> TypedQuery<T> |
createQuery(java.lang.String qlString,
java.lang.Class<T> resultClass)
Creates a TypedQuery for a criteria
|
void |
detach(java.lang.Object entity)
Clears the entity
|
<T> T |
find(java.lang.Class<T> entityClass,
java.lang.Object primaryKey)
Find based on the primary key.
|
<T> T |
find(java.lang.Class<T> entityCLass,
java.lang.Object primaryKey,
LockModeType lockMode)
Find based on the primary key.
|
<T> T |
find(java.lang.Class<T> entityCLass,
java.lang.Object primaryKey,
LockModeType lockMode,
java.util.Map<java.lang.String,java.lang.Object> properties)
Find based on the primary key.
|
<T> T |
find(java.lang.Class<T> entityCLass,
java.lang.Object primaryKey,
java.util.Map<java.lang.String,java.lang.Object> properties)
Find based on the primary key.
|
void |
flush()
Synchronize the context with the database.
|
CriteriaBuilder |
getCriteriaBuilder()
Returns a CriteriaBuilder to create CriteriaQuery objects.
|
java.lang.Object |
getDelegate()
Gets the delegate.
|
EntityManagerFactory |
getEntityManagerFactory()
Returns the owning factory
|
FlushModeType |
getFlushMode()
Returns the flush mode for the objects in the context.
|
LockModeType |
getLockMode(java.lang.Object entity)
Returns the lock mode for the entity
|
Metamodel |
getMetamodel()
Returns the Metamodel interface for the persistence unit.
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Returns the properties for the entity manager
|
<T> T |
getReference(java.lang.Class<T> entityClass,
java.lang.Object primaryKey)
Gets an instance whose state may be lazily fetched.
|
EntityTransaction |
getTransaction()
Returns the transaction manager object.
|
boolean |
isOpen()
Returns true if the entity manager is open.
|
void |
joinTransaction()
Joins the transaction.
|
void |
lock(java.lang.Object entity,
LockModeType lockMode)
Sets the lock mode for an entity.
|
void |
lock(java.lang.Object entity,
LockModeType lockMode,
java.util.Map<java.lang.String,java.lang.Object> properties)
Sets the lock mode for an entity.
|
<T> T |
merge(T entity)
Merge the state of the entity to the current context.
|
void |
persist(java.lang.Object entity)
Makes an object managed and persistent.
|
void |
refresh(java.lang.Object entity)
Update the state of the instance from the database.
|
void |
refresh(java.lang.Object entity,
LockModeType lockMode)
Update the state of the instance from the database.
|
void |
refresh(java.lang.Object entity,
LockModeType lockMode,
java.util.Map<java.lang.String,java.lang.Object> properties)
Update the state of the instance from the database.
|
void |
refresh(java.lang.Object entity,
java.util.Map<java.lang.String,java.lang.Object> properties)
Update the state of the instance from the database.
|
void |
remove(java.lang.Object entity)
Removes the instance.
|
void |
setFlushMode(FlushModeType flushMode)
Sets the flush mode for all objects in the context.
|
void |
setProperty(java.lang.String propertyName,
java.lang.Object value)
Sets properties for the entity manager
|
<T> T |
unwrap(java.lang.Class<T> cls)
Returns the object of the type for a provider-specific API
|
void persist(java.lang.Object entity)
<T> T merge(T entity)
void remove(java.lang.Object entity)
<T> T find(java.lang.Class<T> entityClass, java.lang.Object primaryKey)
<T> T find(java.lang.Class<T> entityCLass, java.lang.Object primaryKey, java.util.Map<java.lang.String,java.lang.Object> properties)
<T> T find(java.lang.Class<T> entityCLass, java.lang.Object primaryKey, LockModeType lockMode)
<T> T find(java.lang.Class<T> entityCLass, java.lang.Object primaryKey, LockModeType lockMode, java.util.Map<java.lang.String,java.lang.Object> properties)
<T> T getReference(java.lang.Class<T> entityClass, java.lang.Object primaryKey)
void flush()
void setFlushMode(FlushModeType flushMode)
FlushModeType getFlushMode()
void lock(java.lang.Object entity, LockModeType lockMode)
void lock(java.lang.Object entity, LockModeType lockMode, java.util.Map<java.lang.String,java.lang.Object> properties)
void refresh(java.lang.Object entity)
void refresh(java.lang.Object entity, java.util.Map<java.lang.String,java.lang.Object> properties)
void refresh(java.lang.Object entity, LockModeType lockMode)
void refresh(java.lang.Object entity, LockModeType lockMode, java.util.Map<java.lang.String,java.lang.Object> properties)
void clear()
void detach(java.lang.Object entity)
boolean contains(java.lang.Object entity)
LockModeType getLockMode(java.lang.Object entity)
void setProperty(java.lang.String propertyName, java.lang.Object value)
java.util.Map<java.lang.String,java.lang.Object> getProperties()
Query createQuery(java.lang.String ql)
<T> TypedQuery<T> createQuery(CriteriaQuery<T> criteriaQuery)
<T> TypedQuery<T> createQuery(java.lang.String qlString, java.lang.Class<T> resultClass)
Query createNamedQuery(java.lang.String name)
<T> TypedQuery<T> createNamedQuery(java.lang.String name, java.lang.Class<T> resultClass)
Query createNativeQuery(java.lang.String sql)
Query createNativeQuery(java.lang.String sql, java.lang.Class resultClass)
Query createNativeQuery(java.lang.String sql, java.lang.String resultSetMapping)
void joinTransaction()
<T> T unwrap(java.lang.Class<T> cls)
java.lang.Object getDelegate()
void close()
boolean isOpen()
EntityTransaction getTransaction()
EntityManagerFactory getEntityManagerFactory()
CriteriaBuilder getCriteriaBuilder()
Metamodel getMetamodel()