public class EntityManagerImpl extends java.lang.Object implements JpaEntityManager
Purpose: Contains the implementation of the EntityManager.
Description: This class provides the implementation for the combined EclipseLink and JPA EntityManager class.
Responsibilities: It is responsible for tracking transaction state and the objects within that transaction.
EntityManager,
JpaEntityManager| Constructor and Description |
|---|
EntityManagerImpl(AbstractSession databaseSession,
java.util.Map properties,
javax.persistence.SynchronizationType syncType)
Constructor called from the EntityManagerFactory to create an
EntityManager
|
EntityManagerImpl(AbstractSession databaseSession,
javax.persistence.SynchronizationType syncType)
Constructor called from the EntityManagerFactory to create an
EntityManager
|
EntityManagerImpl(EntityManagerFactoryDelegate factory,
java.util.Map properties,
javax.persistence.SynchronizationType syncType)
Constructor called from the EntityManagerFactory to create an
EntityManager
|
EntityManagerImpl(java.lang.String sessionName)
Constructor returns an EntityManager assigned to the a particular
DatabaseSession.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addOpenQuery(QueryImpl query)
Queries that leave the connection and are executed against this entity
manager will be added here.
|
void |
clear()
Clear the persistence context, causing all managed entities to become
detached.
|
void |
close()
Closes this EntityManager.
|
boolean |
contains(java.lang.Object entity)
Check if the instance belongs to the current persistence context.
|
java.lang.Object |
copy(java.lang.Object entityOrEntities,
AttributeGroup group)
This method will return copy the passed entity using the passed AttributeGroup.
|
javax.persistence.Query |
createDescriptorNamedQuery(java.lang.String queryName,
java.lang.Class descriptorClass)
This method will create a query object that wraps a EclipseLink Named Query.
|
javax.persistence.Query |
createDescriptorNamedQuery(java.lang.String queryName,
java.lang.Class descriptorClass,
java.util.List argumentTypes)
This method will create a query object that wraps a EclipseLink Named Query.
|
<T> javax.persistence.EntityGraph<T> |
createEntityGraph(java.lang.Class<T> rootType) |
javax.persistence.EntityGraph |
createEntityGraph(java.lang.String graphName) |
javax.persistence.Query |
createNamedQuery(java.lang.String name)
Create an instance of Query for executing a named query (in EJBQL or
native SQL).
|
<T> javax.persistence.TypedQuery<T> |
createNamedQuery(java.lang.String name,
java.lang.Class<T> resultClass)
Create an instance of TypedQuery for executing a
named query (in the Java Persistence query language
or in native SQL).
|
javax.persistence.StoredProcedureQuery |
createNamedStoredProcedureQuery(java.lang.String name)
Create an instance of StoredProcedureQuery for executing a
stored procedure in the database.
|
javax.persistence.Query |
createNativeQuery(java.lang.String sqlString)
Create an instance of Query for executing a native SQL query.
|
javax.persistence.Query |
createNativeQuery(java.lang.String sqlString,
java.lang.Class resultType)
This method is used to create a query using SQL.
|
javax.persistence.Query |
createNativeQuery(java.lang.String sqlString,
java.lang.String resultSetMapping)
Create an instance of Query for executing a native SQL query.
|
javax.persistence.Query |
createQuery(Call call)
This method is used to create a query using a EclipseLink Call.
|
javax.persistence.Query |
createQuery(Call call,
java.lang.Class entityClass)
This method is used to create a query using a EclipseLink Call.
|
javax.persistence.Query |
createQuery(javax.persistence.criteria.CriteriaDelete deleteQuery) |
<T> javax.persistence.TypedQuery<T> |
createQuery(javax.persistence.criteria.CriteriaQuery<T> criteriaQuery) |
javax.persistence.Query |
createQuery(javax.persistence.criteria.CriteriaUpdate updateQuery) |
javax.persistence.Query |
createQuery(DatabaseQuery databaseQuery)
This method is used to create a query using a EclipseLink DatabaseQuery.
|
javax.persistence.Query |
createQuery(Expression expression,
java.lang.Class resultType)
This method is used to create a query using a EclipseLink Expression and
the return type.
|
javax.persistence.Query |
createQuery(java.lang.String jpqlString)
Create an instance of Query for executing an JPQL query.
|
<T> javax.persistence.TypedQuery<T> |
createQuery(java.lang.String qlString,
java.lang.Class<T> resultClass)
Create an instance of TypedQuery for executing a
Java Persistence query language statement.
|
javax.persistence.Query |
createQueryByExample(java.lang.Object exampleObject)
This method is used to create a query using a EclipseLink by example.
|
javax.persistence.StoredProcedureQuery |
createStoredProcedureQuery(java.lang.String procedureName)
Create an instance of
StoredProcedureQuery for executing a
stored procedure in the database. |
javax.persistence.StoredProcedureQuery |
createStoredProcedureQuery(java.lang.String procedureName,
java.lang.Class... resultClasses)
Create an instance of
StoredProcedureQuery for executing a
stored procedure in the database. |
javax.persistence.StoredProcedureQuery |
createStoredProcedureQuery(java.lang.String procedureName,
java.lang.String... resultSetMappings)
Create an instance of
StoredProcedureQuery for executing a
stored procedure in the database. |
void |
detach(java.lang.Object entity)
Remove the given entity from the persistence context, causing a managed
entity to become detached.
|
<T> T |
find(java.lang.Class<T> entityClass,
java.lang.Object primaryKey)
Find by primary key.
|
<T> T |
find(java.lang.Class<T> entityClass,
java.lang.Object primaryKey,
javax.persistence.LockModeType lockMode)
Find by primary key and lock.
|
<T> T |
find(java.lang.Class<T> entityClass,
java.lang.Object primaryKey,
javax.persistence.LockModeType lockMode,
java.util.Map<java.lang.String,java.lang.Object> properties)
Find by primary key and lock.
|
<T> T |
find(java.lang.Class<T> entityClass,
java.lang.Object primaryKey,
java.util.Map<java.lang.String,java.lang.Object> properties)
Find by primary key, using the specified properties.
|
java.lang.Object |
find(java.lang.String entityName,
java.lang.Object primaryKey)
Find by primary key.
|
void |
flush()
Synchronize the persistence context with the underlying database.
|
AbstractSession |
getAbstractSession()
Return the underlying database session
|
RepeatableWriteUnitOfWork |
getActivePersistenceContext(java.lang.Object txn) |
Session |
getActiveSession()
This method returns the current session to the requestor.
|
AbstractSession |
getActiveSessionIfExists()
This method returns the current session to the requestor.
|
javax.persistence.criteria.CriteriaBuilder |
getCriteriaBuilder()
Return an instance of CriteriaBuilder for the creation of
Criteria API Query objects.
|
DatabaseSessionImpl |
getDatabaseSession()
Return the underlying database session
|
java.lang.Object |
getDelegate()
Return the underlying provider object for the EntityManager, if
available.
|
javax.persistence.EntityGraph |
getEntityGraph(java.lang.String graphName) |
<T> java.util.List<javax.persistence.EntityGraph<? super T>> |
getEntityGraphs(java.lang.Class<T> entityClass) |
javax.persistence.EntityManagerFactory |
getEntityManagerFactory()
Return the entity manager factory for the entity manager.
|
javax.persistence.FlushModeType |
getFlushMode()
Get the flush mode that applies to all objects contained in the
persistence context.
|
javax.persistence.LockModeType |
getLockMode(java.lang.Object entity) |
DatabaseSessionImpl |
getMemberDatabaseSession(java.lang.Class cls)
Return the member DatabaseSessionImpl that maps cls in session broker.
|
ServerSession |
getMemberServerSession(java.lang.Class cls)
Return the member ServerSession that maps cls in session broker.
|
java.lang.String |
getMemberSessionName(java.lang.Class cls)
Return the name of member session that maps cls.
|
javax.persistence.metamodel.Metamodel |
getMetamodel()
Return an instance of Metamodel interface for access to the
metamodel of the persistence unit.
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Get the properties and associated values that are in effect for the
entity manager.
|
java.lang.Object |
getProperty(java.lang.String name)
The method search for user defined property passed in from EntityManager,
if it is not found then search for it from EntityManagerFactory
properties.
|
Session |
getReadOnlySession()
Return a read-only session (client session) for read-only operations.
|
<T> T |
getReference(java.lang.Class<T> entityClass,
java.lang.Object primaryKey)
Get an instance, whose state may be lazily fetched.
|
ServerSession |
getServerSession()
Return the underlying server session, throws ClassCastException if it's not a ServerSession.
|
Session |
getSession()
This method will return a Session outside of a transaction and null
within a transaction.
|
SessionBroker |
getSessionBroker()
Return the underlying session broker, throws ClassCastException if it's not a SessionBroker.
|
java.util.Set<java.lang.String> |
getSupportedProperties()
Get the names of the properties that are supported for use with the
entity manager.
|
javax.persistence.SynchronizationType |
getSyncType()
INTERNAL:
Tracks if this EntityManager should automatically associate with the transaction or not
|
javax.persistence.EntityTransaction |
getTransaction()
Returns the resource-level transaction object.
|
UnitOfWork |
getUnitOfWork()
This method will return the active UnitOfWork
|
boolean |
hasActivePersistenceContext()
This method is used in contains to check if we already have a persistence
context.
|
boolean |
isBroker()
Indicates whether the underlying session is a session broker.
|
boolean |
isFlushModeAUTO()
Internal method.
|
boolean |
isJoinedToTransaction() |
boolean |
isOpen()
Indicates whether or not this entity manager and its entity manager factory
are open.
|
void |
joinTransaction()
Indicate to the EntityManager that a JTA transaction is active.
|
void |
load(java.lang.Object entityOrEntities,
AttributeGroup group)
This method will load the passed entity or collection of entities using the passed AttributeGroup.
|
void |
lock(java.lang.Object entity,
javax.persistence.LockModeType lockMode)
Set the lock mode for an entity object contained in the persistence
context.
|
void |
lock(java.lang.Object entity,
javax.persistence.LockModeType lockMode,
java.util.Map<java.lang.String,java.lang.Object> properties)
Set the lock mode for an entity object contained in the persistence
context.
|
<T> T |
merge(T entity)
Merge the state of the given entity into the current persistence context,
using the unqualified class name as the entity name.
|
void |
persist(java.lang.Object entity)
If in a transaction this method will check for existence and register the
object if it is new.
|
static void |
processUnfetchedAttribute(FetchGroupTracker entity,
java.lang.String attributeName)
INTERNAL:
Load/fetch the unfetched object.
|
static void |
processUnfetchedAttributeForSet(FetchGroupTracker entity,
java.lang.String attributeName)
INTERNAL:
Load/fetch the unfetched object.
|
void |
refresh(java.lang.Object entity)
Refresh the state of the instance from the database.
|
void |
refresh(java.lang.Object entity,
javax.persistence.LockModeType lockMode)
Refresh the state of the instance from the database, overwriting changes
made to the entity, if any, and lock it with respect to given lock mode
type.
|
void |
refresh(java.lang.Object entity,
javax.persistence.LockModeType lockMode,
java.util.Map<java.lang.String,java.lang.Object> properties)
Refresh the state of the instance from the database, overwriting changes
made to the entity, if any, and lock it with respect to given lock mode
type.
|
void |
refresh(java.lang.Object entity,
java.util.Map<java.lang.String,java.lang.Object> properties)
Refresh the state of the instance from the database, using the specified
properties, and overwriting changes made to the entity, if any.
|
void |
remove(java.lang.Object entity)
Remove the instance.
|
void |
removeExtendedPersistenceContext()
Internal method called by EntityTransactionImpl class in case of
transaction rollback.
|
void |
setAbstractSession(AbstractSession session)
INTERNAL:
Set the underlying database session
|
void |
setFlushMode(javax.persistence.FlushModeType flushMode)
Set the flush mode that applies to all objects contained in the
persistence context.
|
void |
setProperties(java.util.Map properties)
Use this method to set properties into existing EntityManager that are
normally passed to createEntityManager method.
|
void |
setProperty(java.lang.String propertyName,
java.lang.Object value) |
boolean |
shouldBeginEarlyTransaction()
Indicate the early transaction should be forced to start.
|
boolean |
shouldFlushBeforeQuery() |
<T> T |
unwrap(java.lang.Class<T> cls)
Return an object of the specified type to allow access to the
provider-specific API.
|
void |
verifyOpen() |
void |
verifyOpenWithSetRollbackOnly()
used to save having to constantly use a try/catch to call setRollbackOnly
|
public EntityManagerImpl(java.lang.String sessionName)
sessionName - the DatabaseSession name that should be used. This constructor
can potentially throw EclipseLink exceptions regarding the
existence, or errors with the specified session.public EntityManagerImpl(AbstractSession databaseSession, javax.persistence.SynchronizationType syncType)
databaseSession - the databaseSession assigned to this deployment.public EntityManagerImpl(AbstractSession databaseSession, java.util.Map properties, javax.persistence.SynchronizationType syncType)
databaseSession - the databaseSession assigned to this deployment. Note: The
properties argument is provided to allow properties to be
passed into this EntityManager, but there are currently no
such properties implementedpublic EntityManagerImpl(EntityManagerFactoryDelegate factory, java.util.Map properties, javax.persistence.SynchronizationType syncType)
factory - the EntityMangerFactoryImpl that created this entity manager.
Note: The properties argument is provided to allow properties
to be passed into this EntityManager, but there are currently
no such properties implementedpublic void addOpenQuery(QueryImpl query)
query - public void clear()
clear in interface javax.persistence.EntityManagerpublic void removeExtendedPersistenceContext()
public void persist(java.lang.Object entity)
persist in interface javax.persistence.EntityManagerentity - java.lang.IllegalArgumentException - if the given Object is not an entity.public <T> T merge(T entity)
merge in interface javax.persistence.EntityManagerentity - public void remove(java.lang.Object entity)
remove in interface javax.persistence.EntityManagerentity - java.lang.IllegalArgumentException - if Object passed in is not an entitypublic <T> T find(java.lang.Class<T> entityClass,
java.lang.Object primaryKey)
find in interface javax.persistence.EntityManagerentityClass - - the entity class to find.primaryKey - - the entity primary key value, or primary key class, or a
List of primary key values.java.lang.IllegalArgumentException - if the first argument does not denote an entity type or the
second argument is not a valid type for that entity's primary
key.public <T> T find(java.lang.Class<T> entityClass,
java.lang.Object primaryKey,
java.util.Map<java.lang.String,java.lang.Object> properties)
find in interface javax.persistence.EntityManagerentityClass - primaryKey - properties - standard and vendor-specific propertiesjava.lang.IllegalArgumentException - if the first argument does not denote an entity type or the
second argument is is not a valid type for that entity's
primary key or is nullpublic <T> T find(java.lang.Class<T> entityClass,
java.lang.Object primaryKey,
javax.persistence.LockModeType lockMode)
find in interface javax.persistence.EntityManagerentityClass - primaryKey - lockMode - java.lang.IllegalArgumentException - if the first argument does not denote an entity type or the
second argument is not a valid type for that entity's primary
key or is nulljavax.persistence.TransactionRequiredException - if there is no transaction and a lock mode other than NONE is
setjavax.persistence.OptimisticLockException - if the optimistic version check failsjavax.persistence.PessimisticLockException - if pessimistic locking fails and the transaction is rolled
backjavax.persistence.LockTimeoutException - if pessimistic locking fails and only the statement is rolled
backjavax.persistence.PersistenceException - if an unsupported lock call is madepublic <T> T find(java.lang.Class<T> entityClass,
java.lang.Object primaryKey,
javax.persistence.LockModeType lockMode,
java.util.Map<java.lang.String,java.lang.Object> properties)
find in interface javax.persistence.EntityManagerentityClass - primaryKey - lockMode - properties - standard and vendor-specific properties and hintsjava.lang.IllegalArgumentException - if the first argument does not denote an entity type or the
second argument is not a valid type for that entity's primary
key or is nulljavax.persistence.TransactionRequiredException - if there is no transaction and a lock mode other than NONE is
setjavax.persistence.OptimisticLockException - if the optimistic version check failsjavax.persistence.PessimisticLockException - if pessimistic locking fails and the transaction is rolled
backjavax.persistence.LockTimeoutException - if pessimistic locking fails and only the statement is rolled
backjavax.persistence.PersistenceException - if an unsupported lock call is madepublic java.lang.Object find(java.lang.String entityName,
java.lang.Object primaryKey)
entityClass - - the entity class to find.primaryKey - - the entity primary key value, or primary key class, or a
List of primary key values.java.lang.IllegalArgumentException - if the first argument does not indicate an entity or if the
second argument is not a valid type for that entity's
primaryKey.public void flush()
flush in interface javax.persistence.EntityManagerpublic void refresh(java.lang.Object entity)
refresh in interface javax.persistence.EntityManagerentity - instance registered in the current persistence context.public void refresh(java.lang.Object entity,
java.util.Map<java.lang.String,java.lang.Object> properties)
refresh in interface javax.persistence.EntityManagerentity - properties - standard and vendor-specific propertiesjava.lang.IllegalArgumentException - if the instance is not an entity or the entity is not managedjavax.persistence.TransactionRequiredException - if invoked on a container-managed entity manager of type
PersistenceContextType.TRANSACTION and there is no
transaction.javax.persistence.EntityNotFoundException - if the entity no longer exists in the databasepublic void refresh(java.lang.Object entity,
javax.persistence.LockModeType lockMode)
refresh in interface javax.persistence.EntityManagerentity - lockMode - java.lang.IllegalArgumentException - if the instance is not an entity or the entity is not managedjavax.persistence.TransactionRequiredException - if there is no transactionjavax.persistence.EntityNotFoundException - if the entity no longer exists in the databasejavax.persistence.PessimisticLockException - if pessimistic locking fails and the transaction is rolled
backjavax.persistence.LockTimeoutException - if pessimistic locking fails and only the statement is rolled
backjavax.persistence.PersistenceException - if an unsupported lock call is madepublic void refresh(java.lang.Object entity,
javax.persistence.LockModeType lockMode,
java.util.Map<java.lang.String,java.lang.Object> properties)
refresh in interface javax.persistence.EntityManagerentity - lockMode - properties - standard and vendor-specific properties and hintsjava.lang.IllegalArgumentException - if the instance is not an entity or the entity is not managedjavax.persistence.TransactionRequiredException - if there is no transactionjavax.persistence.EntityNotFoundException - if the entity no longer exists in the databasejavax.persistence.PessimisticLockException - if pessimistic locking fails and the transaction is rolled
backjavax.persistence.LockTimeoutException - if pessimistic locking fails and only the statement is rolled
backjavax.persistence.PersistenceException - if an unsupported lock call is madepublic boolean contains(java.lang.Object entity)
contains in interface javax.persistence.EntityManagerentity - java.lang.IllegalArgumentException - if given Object is not an entitypublic javax.persistence.Query createDescriptorNamedQuery(java.lang.String queryName,
java.lang.Class descriptorClass)
JpaEntityManagercreateDescriptorNamedQuery in interface JpaEntityManagerpublic javax.persistence.Query createDescriptorNamedQuery(java.lang.String queryName,
java.lang.Class descriptorClass,
java.util.List argumentTypes)
JpaEntityManagercreateDescriptorNamedQuery in interface JpaEntityManagerpublic javax.persistence.Query createNamedQuery(java.lang.String name)
createNamedQuery in interface javax.persistence.EntityManagername - the name of a query defined in metadatapublic <T> javax.persistence.TypedQuery<T> createNamedQuery(java.lang.String name,
java.lang.Class<T> resultClass)
createNamedQuery in interface javax.persistence.EntityManagername - the name of a query defined in metadataresultClass - the type of the query resultjava.lang.IllegalArgumentException - if a query has not been
defined with the given name or if the query string is
found to be invalidpublic javax.persistence.StoredProcedureQuery createNamedStoredProcedureQuery(java.lang.String name)
createNamedStoredProcedureQuery in interface javax.persistence.EntityManagername - name assigned to the stored procedure query
in metadatajava.lang.IllegalArgumentException - if a query has not been
defined with the given namepublic javax.persistence.Query createNativeQuery(java.lang.String sqlString)
createNativeQuery in interface javax.persistence.EntityManagersqlString - a native SQL query stringpublic javax.persistence.Query createNativeQuery(java.lang.String sqlString,
java.lang.Class resultType)
createNativeQuery in interface javax.persistence.EntityManagerpublic javax.persistence.Query createNativeQuery(java.lang.String sqlString,
java.lang.String resultSetMapping)
createNativeQuery in interface javax.persistence.EntityManagersqlString - a native SQL query stringresultSetMapping - the name of the result set mappingjava.lang.IllegalArgumentException - if query string is not validpublic Session getActiveSession()
getActiveSession in interface JpaEntityManagerpublic AbstractSession getActiveSessionIfExists()
public java.lang.Object getDelegate()
getDelegate in interface javax.persistence.EntityManagerpublic javax.persistence.FlushModeType getFlushMode()
getFlushMode in interface javax.persistence.EntityManagerpublic UnitOfWork getUnitOfWork()
getUnitOfWork in interface JpaEntityManagerpublic Session getSession()
getSession in interface JpaEntityManagerpublic javax.persistence.EntityTransaction getTransaction()
getTransaction in interface javax.persistence.EntityManagerjava.lang.IllegalStateException - if invoked on a JTA EntityManager.public java.lang.Object getProperty(java.lang.String name)
name - public <T> T getReference(java.lang.Class<T> entityClass,
java.lang.Object primaryKey)
getReference in interface javax.persistence.EntityManagerentityClass - primaryKey - java.lang.IllegalArgumentException - if the first argument does not denote an entity type or the
second argument is not a valid type for that entity's primary
key.javax.persistence.EntityNotFoundException - if the entity state cannot be accessed.public Session getReadOnlySession()
public DatabaseSessionImpl getDatabaseSession()
getDatabaseSession in interface JpaEntityManagerpublic AbstractSession getAbstractSession()
getAbstractSession in interface JpaEntityManagerpublic void setAbstractSession(AbstractSession session)
public ServerSession getServerSession()
getServerSession in interface JpaEntityManagerpublic SessionBroker getSessionBroker()
getSessionBroker in interface JpaEntityManagerpublic DatabaseSessionImpl getMemberDatabaseSession(java.lang.Class cls)
getMemberDatabaseSession in interface JpaEntityManagerpublic ServerSession getMemberServerSession(java.lang.Class cls)
getMemberServerSession in interface JpaEntityManagerpublic java.lang.String getMemberSessionName(java.lang.Class cls)
getMemberSessionName in interface JpaEntityManagerpublic javax.persistence.Query createQuery(Expression expression, java.lang.Class resultType)
createQuery in interface JpaEntityManagerpublic javax.persistence.Query createQuery(DatabaseQuery databaseQuery)
createQuery in interface JpaEntityManagerpublic <T> javax.persistence.TypedQuery<T> createQuery(javax.persistence.criteria.CriteriaQuery<T> criteriaQuery)
createQuery in interface javax.persistence.EntityManagerEntityManager.createQuery(javax.persistence.criteria.CriteriaQuery)public javax.persistence.Query createQueryByExample(java.lang.Object exampleObject)
createQueryByExample in interface JpaEntityManagerpublic javax.persistence.Query createQuery(Call call)
createQuery in interface JpaEntityManagerpublic javax.persistence.Query createQuery(Call call, java.lang.Class entityClass)
createQuery in interface JpaEntityManagerpublic javax.persistence.Query createQuery(java.lang.String jpqlString)
createQuery in interface javax.persistence.EntityManagerjpqlString - an JPQL query stringpublic <T> javax.persistence.TypedQuery<T> createQuery(java.lang.String qlString,
java.lang.Class<T> resultClass)
createQuery in interface javax.persistence.EntityManagerqlString - a Java Persistence query stringresultClass - the type of the query resultjava.lang.IllegalArgumentException - if the query string is found
to be invalidpublic javax.persistence.StoredProcedureQuery createStoredProcedureQuery(java.lang.String procedureName)
StoredProcedureQuery for executing a
stored procedure in the database.
Parameters must be registered before the stored procedure can be executed.
If the stored procedure returns one or more result sets, any result set will be returned as a list of type Object[].
createStoredProcedureQuery in interface javax.persistence.EntityManagerprocedureName - name of the stored procedure in the databasejava.lang.IllegalArgumentException - if a stored procedure of the given name
does not exist (or the query execution will fail)public javax.persistence.StoredProcedureQuery createStoredProcedureQuery(java.lang.String procedureName,
java.lang.Class... resultClasses)
StoredProcedureQuery for executing a
stored procedure in the database.
Parameters must be registered before the stored procedure can be executed.
The resultClass arguments must be specified in the order
in which the result sets will be returned by the stored procedure
invocation.
createStoredProcedureQuery in interface javax.persistence.EntityManagerprocedureName - name of the stored procedure in the databaseresultClasses - classes to which the result sets produced by the
stored procedure are to be mappedjava.lang.IllegalArgumentException - if a stored procedure of the given name
does not exist (or the query execution will fail)public javax.persistence.StoredProcedureQuery createStoredProcedureQuery(java.lang.String procedureName,
java.lang.String... resultSetMappings)
StoredProcedureQuery for executing a
stored procedure in the database.
Parameters must be registered before the stored procedure can be executed.
The resultSetMapping arguments must be specified in the
order in which the result sets will be returned by the stored procedure
invocation.
createStoredProcedureQuery in interface javax.persistence.EntityManagerprocedureName - name of the stored procedure in the databaseresultSetMappings - the names of the result set mappings
to be used in mapping result sets
returned by the stored procedurejava.lang.IllegalArgumentException - if a stored procedure or
result set mapping of the given name does not exist
(or the query execution will fail)public void close()
Closes this EntityManager.
After invoking this method, all methods on the instance will throw an
IllegalStateException except for isOpen, which will
return false .
This should be called when a method is finished with the EntityManager in a bean-managed transaction environment or when executed outside a container. Closing of the EntityManager is handled by the container when using container-managed transactions.
close in interface javax.persistence.EntityManagerpublic boolean isFlushModeAUTO()
public boolean isOpen()
true until a call to close() is made.isOpen in interface javax.persistence.EntityManagerpublic void lock(java.lang.Object entity,
javax.persistence.LockModeType lockMode)
lock in interface javax.persistence.EntityManagerentity - lockMode - javax.persistence.PersistenceException - if an unsupported lock call is madejava.lang.IllegalArgumentException - if the instance is not an entity or is a detached entityjavax.persistence.TransactionRequiredException - if there is no transactionpublic void lock(java.lang.Object entity,
javax.persistence.LockModeType lockMode,
java.util.Map<java.lang.String,java.lang.Object> properties)
lock in interface javax.persistence.EntityManagerentity - lockMode - javax.persistence.PersistenceException - if an unsupported lock call is madejava.lang.IllegalArgumentException - if the instance is not an entity or is a detached entityjavax.persistence.TransactionRequiredException - if there is no transactionpublic void verifyOpen()
public void verifyOpenWithSetRollbackOnly()
public RepeatableWriteUnitOfWork getActivePersistenceContext(java.lang.Object txn)
public void setProperties(java.util.Map properties)
public void setProperty(java.lang.String propertyName,
java.lang.Object value)
setProperty in interface javax.persistence.EntityManagerEntityManager.setProperty(java.lang.String, java.lang.Object)public boolean hasActivePersistenceContext()
public boolean shouldFlushBeforeQuery()
public boolean shouldBeginEarlyTransaction()
public void joinTransaction()
joinTransaction in interface javax.persistence.EntityManagerjavax.persistence.TransactionRequiredException - if there is no transaction.public void setFlushMode(javax.persistence.FlushModeType flushMode)
setFlushMode in interface javax.persistence.EntityManagerflushMode - public boolean isBroker()
isBroker in interface JpaEntityManagerpublic void detach(java.lang.Object entity)
detach in interface javax.persistence.EntityManagerentity - java.lang.IllegalArgumentException - if the instance is not an entitypublic javax.persistence.criteria.CriteriaBuilder getCriteriaBuilder()
getCriteriaBuilder in interface javax.persistence.EntityManagerjava.lang.IllegalStateException - if the entity manager has
been closed.EntityManager.getCriteriaBuilder()public javax.persistence.metamodel.Metamodel getMetamodel()
getMetamodel in interface javax.persistence.EntityManagerjava.lang.IllegalStateException - if the entity manager has
been closed.EntityManager.getMetamodel()public javax.persistence.EntityManagerFactory getEntityManagerFactory()
getEntityManagerFactory in interface javax.persistence.EntityManagerjava.lang.IllegalStateException - if the entity manager has been closed.public javax.persistence.LockModeType getLockMode(java.lang.Object entity)
getLockMode in interface javax.persistence.EntityManagerEntityManager.getLockMode(java.lang.Object)public java.util.Map<java.lang.String,java.lang.Object> getProperties()
getProperties in interface javax.persistence.EntityManagerpublic java.util.Set<java.lang.String> getSupportedProperties()
public <T> T unwrap(java.lang.Class<T> cls)
unwrap in interface javax.persistence.EntityManagercls - the class of the object to be returned. This is normally
either the underlying EntityManager implementation class or an
interface that it implements.javax.persistence.PersistenceException - if the provider does not support the call.public void load(java.lang.Object entityOrEntities,
AttributeGroup group)
load in interface JpaEntityManagerentityOrEntities - public java.lang.Object copy(java.lang.Object entityOrEntities,
AttributeGroup group)
copy in interface JpaEntityManagerentityOrEntities - public static void processUnfetchedAttribute(FetchGroupTracker entity, java.lang.String attributeName)
public static void processUnfetchedAttributeForSet(FetchGroupTracker entity, java.lang.String attributeName)
public javax.persistence.Query createQuery(javax.persistence.criteria.CriteriaUpdate updateQuery)
createQuery in interface javax.persistence.EntityManagerpublic javax.persistence.Query createQuery(javax.persistence.criteria.CriteriaDelete deleteQuery)
createQuery in interface javax.persistence.EntityManagerpublic boolean isJoinedToTransaction()
isJoinedToTransaction in interface javax.persistence.EntityManagerpublic <T> javax.persistence.EntityGraph<T> createEntityGraph(java.lang.Class<T> rootType)
createEntityGraph in interface javax.persistence.EntityManagerpublic javax.persistence.EntityGraph createEntityGraph(java.lang.String graphName)
createEntityGraph in interface javax.persistence.EntityManagerpublic javax.persistence.EntityGraph getEntityGraph(java.lang.String graphName)
getEntityGraph in interface javax.persistence.EntityManagerpublic <T> java.util.List<javax.persistence.EntityGraph<? super T>> getEntityGraphs(java.lang.Class<T> entityClass)
getEntityGraphs in interface javax.persistence.EntityManagerpublic javax.persistence.SynchronizationType getSyncType()
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference