public class EntityManagerImpl extends Object implements EntityManager
EntityManager.| Constructor and Description |
|---|
EntityManagerImpl(EntityManagerFactoryImpl entityManagerFactory,
MetamodelImpl metamodel,
DataSourceImpl datasource,
Map<String,Object> properties,
JdbcAdaptor jdbcAdaptor) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertOpen()
Checks if the entity manager is open.
|
void |
assertTransaction()
Asserts that a transaction is active.
|
<T> void |
cascadeMerge(EntityTypeImpl<T> type,
T entity,
org.apache.commons.lang.mutable.MutableBoolean requiresFlush,
IdentityHashMap<Object,Object> processed)
Cascades the merge operation
|
void |
clear() |
void |
clearTransaction()
Clears the transaction.
|
void |
close() |
protected void |
closeConnection()
Closes the database connection.
|
void |
closeConnectionIfNecessary()
Closes the connection if the connections is obtained from JTA managed datasource.
|
boolean |
contains(Object entity) |
Query |
createNamedQuery(String name) |
<T> TypedQuery<T> |
createNamedQuery(String name,
Class<T> resultClass) |
Query |
createNativeQuery(String sqlString) |
Query |
createNativeQuery(String sqlString,
Class<?> resultClass) |
Query |
createNativeQuery(String sqlString,
String resultSetMapping) |
Query |
createQuery(CriteriaDeleteImpl<?> deleteQuery) |
<T> QueryImpl<T> |
createQuery(CriteriaQuery<T> criteriaQuery) |
Query |
createQuery(CriteriaUpdateImpl<?> updateQuery) |
Query |
createQuery(String qlString) |
<T> TypedQuery<T> |
createQuery(String qlString,
Class<T> resultClass) |
void |
detach(Object entity) |
<T> T |
find(Class<T> entityClass,
Object primaryKey) |
<T> T |
find(Class<T> entityClass,
Object primaryKey,
LockModeType lockMode) |
<T> T |
find(Class<T> entityClass,
Object primaryKey,
LockModeType lockMode,
Map<String,Object> properties) |
<T> T |
find(Class<T> entityClass,
Object primaryKey,
Map<String,Object> properties) |
void |
flush() |
ConnectionImpl |
getConnection()
Returns the active connection.
|
CriteriaBuilderImpl |
getCriteriaBuilder() |
Object |
getDelegate() |
EntityManagerFactoryImpl |
getEntityManagerFactory() |
FlushModeType |
getFlushMode() |
JdbcAdaptor |
getJdbcAdaptor()
Returns the JDBC adaptor.
|
LockModeType |
getLockMode(Object entity) |
MetamodelImpl |
getMetamodel() |
Map<String,Object> |
getProperties() |
<T> T |
getReference(Class<T> entityClass,
Object primaryKey) |
SessionImpl |
getSession()
Returns the session.
|
EntityTransactionImpl |
getTransaction() |
boolean |
hasTransactionMarkedForRollback()
Returns if the entity manager has a transaction which is marked for rollback.
|
boolean |
isJoinedToTransaction() |
boolean |
isOpen() |
void |
isValid(EntityTransactionImpl transaction)
Check if the transaction is valid and belongs to this entity manager.
|
void |
joinTransaction() |
void |
lock(ManagedInstance<?> instance,
LockModeType lockMode,
Map<String,Object> properties)
Locks the entity.
|
void |
lock(Object entity,
LockModeType lockMode) |
void |
lock(Object entity,
LockModeType lockMode,
Map<String,Object> properties) |
<T> T |
merge(T entity) |
<T> T |
mergeImpl(T entity,
org.apache.commons.lang.mutable.MutableBoolean requiresFlush,
IdentityHashMap<Object,Object> processed,
boolean cascade)
Cascaded implementation of
merge(Object). |
void |
persist(Object entity) |
<T> boolean |
persistImpl(T entity,
ArrayList<Object> processed)
Cascaded implementation of
persist(Object). |
void |
refresh(Object entity) |
void |
refresh(Object entity,
LockModeType lockMode) |
void |
refresh(Object entity,
LockModeType lockMode,
Map<String,Object> properties) |
void |
refresh(Object entity,
Map<String,Object> properties) |
void |
remove(Object entity) |
void |
setFlushMode(FlushModeType flushMode) |
void |
setProperty(String propertyName,
Object value) |
<T> T |
unwrap(Class<T> clazz) |
public EntityManagerImpl(EntityManagerFactoryImpl entityManagerFactory, MetamodelImpl metamodel, DataSourceImpl datasource, Map<String,Object> properties, JdbcAdaptor jdbcAdaptor)
entityManagerFactory - the entity manager factorymetamodel - the metamodeldatasource - the datasourceproperties - properties for the entity managerjdbcAdaptor - the JDBC adaptorprotected void assertOpen()
public void assertTransaction()
public <T> void cascadeMerge(EntityTypeImpl<T> type, T entity, org.apache.commons.lang.mutable.MutableBoolean requiresFlush, IdentityHashMap<Object,Object> processed)
T - the type of the entitytype - the entity typeentity - the entityrequiresFlush - if an implicit flush is requiredprocessed - registry of processed entitiespublic void clear()
clear in interface EntityManagerpublic void clearTransaction()
public void close()
close in interface EntityManagerprotected void closeConnection()
public void closeConnectionIfNecessary()
public boolean contains(Object entity)
contains in interface EntityManagerpublic Query createNamedQuery(String name)
createNamedQuery in interface EntityManagerpublic <T> TypedQuery<T> createNamedQuery(String name, Class<T> resultClass)
createNamedQuery in interface EntityManagerpublic Query createNativeQuery(String sqlString)
createNativeQuery in interface EntityManagerpublic Query createNativeQuery(String sqlString, Class<?> resultClass)
createNativeQuery in interface EntityManagerpublic Query createNativeQuery(String sqlString, String resultSetMapping)
createNativeQuery in interface EntityManagerpublic Query createQuery(CriteriaDeleteImpl<?> deleteQuery)
public <T> QueryImpl<T> createQuery(CriteriaQuery<T> criteriaQuery)
createQuery in interface EntityManagerpublic Query createQuery(CriteriaUpdateImpl<?> updateQuery)
public Query createQuery(String qlString)
createQuery in interface EntityManagerpublic <T> TypedQuery<T> createQuery(String qlString, Class<T> resultClass)
createQuery in interface EntityManagerpublic void detach(Object entity)
detach in interface EntityManagerpublic <T> T find(Class<T> entityClass, Object primaryKey)
find in interface EntityManagerpublic <T> T find(Class<T> entityClass, Object primaryKey, LockModeType lockMode)
find in interface EntityManagerpublic <T> T find(Class<T> entityClass, Object primaryKey, LockModeType lockMode, Map<String,Object> properties)
find in interface EntityManagerpublic <T> T find(Class<T> entityClass, Object primaryKey, Map<String,Object> properties)
find in interface EntityManagerpublic void flush()
flush in interface EntityManagerpublic ConnectionImpl getConnection()
public CriteriaBuilderImpl getCriteriaBuilder()
getCriteriaBuilder in interface EntityManagerpublic Object getDelegate()
getDelegate in interface EntityManagerpublic EntityManagerFactoryImpl getEntityManagerFactory()
getEntityManagerFactory in interface EntityManagerpublic FlushModeType getFlushMode()
getFlushMode in interface EntityManagerpublic JdbcAdaptor getJdbcAdaptor()
public LockModeType getLockMode(Object entity)
getLockMode in interface EntityManagerpublic MetamodelImpl getMetamodel()
getMetamodel in interface EntityManagerpublic Map<String,Object> getProperties()
getProperties in interface EntityManagerpublic <T> T getReference(Class<T> entityClass, Object primaryKey)
getReference in interface EntityManagerpublic SessionImpl getSession()
public EntityTransactionImpl getTransaction()
getTransaction in interface EntityManagerpublic boolean hasTransactionMarkedForRollback()
public boolean isJoinedToTransaction()
isJoinedToTransaction in interface EntityManagerpublic boolean isOpen()
isOpen in interface EntityManagerpublic void isValid(EntityTransactionImpl transaction)
transaction - the transaction to test the validitypublic void joinTransaction()
joinTransaction in interface EntityManagerpublic void lock(ManagedInstance<?> instance, LockModeType lockMode, Map<String,Object> properties)
instance - the managed instancelockMode - the lock modeproperties - the propertiespublic void lock(Object entity, LockModeType lockMode)
lock in interface EntityManagerpublic void lock(Object entity, LockModeType lockMode, Map<String,Object> properties)
lock in interface EntityManagerpublic <T> T merge(T entity)
merge in interface EntityManagerpublic <T> T mergeImpl(T entity,
org.apache.commons.lang.mutable.MutableBoolean requiresFlush,
IdentityHashMap<Object,Object> processed,
boolean cascade)
merge(Object).
Also manages a direct or indirect requirement to an implicit flush.
T - the type of the entityentity - the entity to cascaderequiresFlush - if an implicit flush is requiredprocessed - registry of processed entitiescascade - cascades the merge operationpublic void persist(Object entity)
persist in interface EntityManagerpublic <T> boolean persistImpl(T entity,
ArrayList<Object> processed)
persist(Object).
Also manages a direct or indirect requirement to an implicit flush.
T - the type of the entityentity - the entity to cascadeprocessed - registry of processed entitiespublic void refresh(Object entity)
refresh in interface EntityManagerpublic void refresh(Object entity, LockModeType lockMode)
refresh in interface EntityManagerpublic void refresh(Object entity, LockModeType lockMode, Map<String,Object> properties)
refresh in interface EntityManagerpublic void refresh(Object entity, Map<String,Object> properties)
refresh in interface EntityManagerpublic void remove(Object entity)
remove in interface EntityManagerpublic void setFlushMode(FlushModeType flushMode)
setFlushMode in interface EntityManagerpublic void setProperty(String propertyName, Object value)
setProperty in interface EntityManagerpublic <T> T unwrap(Class<T> clazz)
unwrap in interface EntityManagerCopyright © 2012 Batoo Software & Consultancy. All Rights Reserved.