public class EntityManagerImpl extends EntityManagerImpl implements EntityManager
Purpose: Contains the implementation of the EntityManager.
Description: This class provides the implementation for the combined TopLink and EJB3.0 EntityManager class.
Responsibilities:It is responcible for tracking transaction state and the objects within that transaction.
EntityManager,
EntityManagerextended, extendedPersistenceContext, factory, isOpen, propagatePersistenceContext, serverSession, transaction| Constructor and Description |
|---|
EntityManagerImpl(EntityManagerFactoryImpl factory,
java.util.Map properties,
boolean propagePersistenceContext,
boolean extended)
Constructor called from the EntityManagerFactory to create an EntityManager
|
EntityManagerImpl(ServerSession serverSession,
boolean propagatePersistenceContext,
boolean extended)
Constructor called from the EntityManagerFactory to create an EntityManager
|
EntityManagerImpl(ServerSession serverSession,
java.util.Map properties,
boolean propagePersistenceContext,
boolean extended)
Constructor called from the EntityManagerFactory to create an EntityManager
|
EntityManagerImpl(java.lang.String sessionName,
boolean propagatePersistenceContext,
boolean extended)
Constructor returns an EntityManager assigned to the a particular ServerSession.
|
| Modifier and Type | Method and Description |
|---|---|
javax.persistence.Query |
createNamedQuery(java.lang.String name)
Create an instance of Query for executing a
named query (in EJBQL or native SQL).
|
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(Expression expression,
java.lang.Class resultType)
This method is used to create a query using a Toplink Expression and the return type.
|
javax.persistence.Query |
createQuery(java.lang.String ejbqlString)
Create an instance of Query for executing an
EJBQL query.
|
<T> T |
find(java.lang.Class<T> entityClass,
java.lang.Object primaryKey)
Find by primary key.
|
javax.persistence.FlushModeType |
getFlushMode()
Get the flush mode that applies to all objects contained
in the persistence context.
|
<T> T |
getReference(java.lang.Class<T> entityClass,
java.lang.Object primaryKey)
Get an instance, whose state may be lazily fetched.
|
javax.persistence.EntityTransaction |
getTransaction()
Returns the resource-level transaction object.
|
boolean |
isFlushModeAUTO()
Internal method.
|
<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.
|
protected void |
setEntityTransactionWrapper() |
void |
setFlushMode(javax.persistence.FlushModeType flushMode)
Set the flush mode that applies to all objects contained
in the persistence context.
|
protected void |
setJTATransactionWrapper() |
checkForTransaction, clear, close, contains, contains, createNativeQueryInternal, createQueryInternal, detectTransactionWrapper, find, findInternal, findInternal, flush, getActivePersistenceContext, getActiveSession, getDelegate, getServerSession, getSession, getTransactionalUnitOfWork_new, getUnitOfWork, isExtended, isOpen, joinTransaction, lock, mergeInternal, persist, refresh, remove, removeExtendedPersistenceContext, setRollbackOnly, shouldFlushBeforeQuery, shouldPropagatePersistenceContext, verifyOpenclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetActiveSession, getServerSession, getSession, getUnitOfWorkpublic EntityManagerImpl(java.lang.String sessionName,
boolean propagatePersistenceContext,
boolean extended)
sessionName - the ServerSession name that should be used.
This constructor can potentially throw TopLink exceptions regarding the existence, or
errors with the specified session.public EntityManagerImpl(ServerSession serverSession, boolean propagatePersistenceContext, boolean extended)
serverSession - the serverSession assigned to this deployment.public EntityManagerImpl(ServerSession serverSession, java.util.Map properties, boolean propagePersistenceContext, boolean extended)
serverSession - the serverSession 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(EntityManagerFactoryImpl factory, java.util.Map properties, boolean propagePersistenceContext, boolean extended)
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 <T> T merge(T entity)
merge in interface javax.persistence.EntityManagerentity - public <T> T find(java.lang.Class<T> entityClass,
java.lang.Object primaryKey)
find 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 keypublic <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 keyEntityNotFoundException - if the entity state
cannot be accessedpublic javax.persistence.Query createQuery(java.lang.String ejbqlString)
createQuery in interface javax.persistence.EntityManagerejbqlString - an EJBQL query stringpublic javax.persistence.Query createNamedQuery(java.lang.String name)
createNamedQuery in interface javax.persistence.EntityManagername - the name of a query defined in metadatapublic 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 javax.persistence.FlushModeType getFlushMode()
getFlushMode in interface javax.persistence.EntityManagerpublic void setFlushMode(javax.persistence.FlushModeType flushMode)
setFlushMode in interface javax.persistence.EntityManagerflushMode - public javax.persistence.Query createQuery(Expression expression, java.lang.Class resultType)
public javax.persistence.EntityTransaction getTransaction()
getTransaction in interface javax.persistence.EntityManagerjava.lang.IllegalStateException - if invoked on a JTA
EntityManager.public boolean isFlushModeAUTO()
isFlushModeAUTO in class EntityManagerImplprotected void setJTATransactionWrapper()
setJTATransactionWrapper in class EntityManagerImplprotected void setEntityTransactionWrapper()
setEntityTransactionWrapper in class EntityManagerImpl