Methods Summary |
---|
public void | clear()Clear the persistence context, causing all managed
entities to become detached. Changes made to entities that
have not been flushed to the database will not be
persisted.
|
public void | close()Close an application-managed EntityManager.
After the close method has been invoked, all methods
on the EntityManager instance and any Query objects obtained
from it will throw the IllegalStateException except
for getTransaction and isOpen (which will return false).
If this method is called when the EntityManager is
associated with an active transaction, the persistence
context remains managed until the transaction completes.
|
public boolean | contains(java.lang.Object entity)Check if the instance belongs to the current persistence
context.
|
public javax.persistence.Query | createNamedQuery(java.lang.String name)Create an instance of Query for executing a
named query (in the Java Persistence query language or in native SQL).
|
public javax.persistence.Query | createNativeQuery(java.lang.String sqlString)Create an instance of Query for executing
a native SQL statement, e.g., for update or delete.
|
public javax.persistence.Query | createNativeQuery(java.lang.String sqlString, java.lang.Class resultClass)Create an instance of Query for executing
a native SQL query.
|
public javax.persistence.Query | createNativeQuery(java.lang.String sqlString, java.lang.String resultSetMapping)Create an instance of Query for executing
a native SQL query.
|
public javax.persistence.Query | createQuery(java.lang.String qlString)Create an instance of Query for executing a
Java Persistence query language statement.
|
public T | find(java.lang.Class entityClass, java.lang.Object primaryKey)Find by primary key.
|
public void | flush()Synchronize the persistence context to the
underlying database.
|
public java.lang.Object | getDelegate()Return the underlying provider object for the EntityManager,
if available. The result of this method is implementation
specific.
|
public javax.persistence.FlushModeType | getFlushMode()Get the flush mode that applies to all objects contained
in the persistence context.
|
public T | getReference(java.lang.Class entityClass, java.lang.Object primaryKey)Get an instance, whose state may be lazily fetched.
If the requested instance does not exist in the database,
throws {@link EntityNotFoundException} when the instance state is
first accessed. (The persistence provider runtime is permitted to throw
{@link EntityNotFoundException} when {@link #getReference} is called.)
The application should not expect that the instance state will
be available upon detachment, unless it was accessed by the
application while the entity manager was open.
|
public javax.persistence.EntityTransaction | getTransaction()Returns the resource-level transaction object.
The EntityTransaction instance may be used serially to
begin and commit multiple transactions.
|
public boolean | isOpen()Determine whether the EntityManager is open.
|
public void | joinTransaction()Indicate to the EntityManager that a JTA transaction is
active. This method should be called on a JTA application
managed EntityManager that was created outside the scope
of the active transaction to associate it with the current
JTA transaction.
|
public void | lock(java.lang.Object entity, javax.persistence.LockModeType lockMode)Set the lock mode for an entity object contained
in the persistence context.
|
public T | merge(T entity)Merge the state of the given entity into the
current persistence context.
|
public void | persist(java.lang.Object entity)Make an entity instance managed and persistent.
|
public void | refresh(java.lang.Object entity)Refresh the state of the instance from the database,
overwriting changes made to the entity, if any.
|
public void | remove(java.lang.Object entity)Remove the entity instance.
|
public void | setFlushMode(javax.persistence.FlushModeType flushMode)Set the flush mode that applies to all objects contained
in the persistence context.
|