|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.cayenne.jpa.ResourceLocalEntityManager
public class ResourceLocalEntityManager
| Field Summary | |
|---|---|
protected ObjectContext |
context
|
protected ResourceLocalEntityManagerFactory |
factory
|
protected javax.persistence.FlushModeType |
flushMode
|
protected boolean |
open
|
protected javax.persistence.EntityTransaction |
transaction
|
| Constructor Summary | |
|---|---|
ResourceLocalEntityManager(ObjectContext context,
ResourceLocalEntityManagerFactory factory)
|
|
| Method Summary | ||
|---|---|---|
protected void |
checkAttached(Object entity)
Checks if an entity is attached to the current EntityManager, throwing IllegalArgumentException if not. |
|
protected void |
checkClosed()
Throws an exception if called on closed factory. |
|
protected void |
checkNotRemoved(Object entity)
Checks if an entity is not removed in the current EntityManager, throwing IllegalArgumentException if it is. |
|
void |
clear()
Clear the persistence context, causing all managed entities to become detached. |
|
void |
close()
Close an application-managed EntityManager. |
|
boolean |
contains(Object entity)
Check if the instance belongs to the current persistence context. |
|
javax.persistence.Query |
createNamedQuery(String name)
Create an instance of Query for executing a named query (in EJB QL or native SQL). |
|
javax.persistence.Query |
createNativeQuery(String sqlString)
Create an instance of Query for executing a native SQL statement, e.g., for update or delete. |
|
javax.persistence.Query |
createNativeQuery(String sqlString,
Class resultClass)
|
|
javax.persistence.Query |
createNativeQuery(String sqlString,
String resultSetMapping)
Create an instance of Query for executing a native SQL query. |
|
javax.persistence.Query |
createQuery(String ejbqlString)
Create an instance of Query for executing an EJB QL statement. |
|
|
find(Class<T> entityClass,
Object primaryKey)
Find by primary key. |
|
void |
flush()
Synchronize the persistence context to the underlying database. |
|
DataChannel |
getChannel()
Returns a DataChannel of the peer ObjectContext. |
|
Object |
getDelegate()
|
|
protected ResourceLocalEntityManagerFactory |
getFactory()
Returns parent EntityManagerFactory. |
|
javax.persistence.FlushModeType |
getFlushMode()
Get the flush mode that applies to all objects contained in the persistence context. |
|
|
getReference(Class<T> entityClass,
Object primaryKey)
Get an instance, whose state may be lazily fetched. |
|
javax.persistence.EntityTransaction |
getTransaction()
Return the resource-level transaction object. |
|
boolean |
isOpen()
|
|
void |
joinTransaction()
Indicates to the EntityManager that a JTA transaction is active. |
|
void |
lock(Object entity,
javax.persistence.LockModeType lockMode)
|
|
|
merge(T entity)
Merge the state of the given entity into the current persistence context. |
|
void |
persist(Object entity)
Make an instance managed and persistent. |
|
void |
refresh(Object entity)
Refresh the state of the instance from the database, overwriting changes made to the entity, if any. |
|
void |
remove(Object entity)
Remove the entity instance. |
|
void |
setFlushMode(javax.persistence.FlushModeType flushMode)
Set the flush mode that applies to all objects contained in the persistence context. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected javax.persistence.EntityTransaction transaction
protected ResourceLocalEntityManagerFactory factory
protected javax.persistence.FlushModeType flushMode
protected boolean open
protected ObjectContext context
| Constructor Detail |
|---|
public ResourceLocalEntityManager(ObjectContext context,
ResourceLocalEntityManagerFactory factory)
| Method Detail |
|---|
public DataChannel getChannel()
getChannel in interface CayenneEntityManagerprotected ResourceLocalEntityManagerFactory getFactory()
public void close()
close in interface javax.persistence.EntityManagerIllegalStateException - if the EntityManager is associated with an active
transaction or if the EntityManager is container-managed.public boolean isOpen()
isOpen in interface javax.persistence.EntityManagerpublic Object getDelegate()
getDelegate in interface javax.persistence.EntityManagerpublic void persist(Object entity)
persist in interface javax.persistence.EntityManagerentity - an object to be made persistent
IllegalArgumentException - if not an entity.public <T> T merge(T entity)
merge in interface javax.persistence.EntityManagerentity -
IllegalArgumentException - if instance is not an entity or is a removed
entitypublic void remove(Object entity)
remove in interface javax.persistence.EntityManagerentity -
IllegalArgumentException - if not an entity or if a detached entity.
public <T> T find(Class<T> entityClass,
Object primaryKey)
find in interface javax.persistence.EntityManagerentityClass - primaryKey -
IllegalArgumentException - if the first argument does not denote an entity
type or the second argument is not a valid type for that
public <T> T getReference(Class<T> entityClass,
Object primaryKey)
getReference in interface javax.persistence.EntityManagerentityClass - primaryKey -
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 accessedpublic void flush()
flush in interface javax.persistence.EntityManagerjavax.persistence.PersistenceException - if the flush failspublic void setFlushMode(javax.persistence.FlushModeType flushMode)
setFlushMode in interface javax.persistence.EntityManagerflushMode - public javax.persistence.FlushModeType getFlushMode()
getFlushMode in interface javax.persistence.EntityManagerpublic void refresh(Object entity)
refresh in interface javax.persistence.EntityManagerentity -
IllegalArgumentException - if not an entity or entity is not managed
javax.persistence.EntityNotFoundException - if the entity no longer exists in the databasepublic void clear()
clear in interface javax.persistence.EntityManagerpublic boolean contains(Object entity)
contains in interface javax.persistence.EntityManagerIllegalArgumentException - if not an entitypublic javax.persistence.Query createQuery(String ejbqlString)
createQuery in interface javax.persistence.EntityManagerejbqlString - an EJB QL query string
IllegalArgumentException - if query string is not validpublic javax.persistence.Query createNamedQuery(String name)
createNamedQuery in interface javax.persistence.EntityManagername - the name of a query defined in metadata
IllegalArgumentException - if a query has not been defined with the given
name
public javax.persistence.Query createNativeQuery(String sqlString,
Class resultClass)
createNativeQuery in interface javax.persistence.EntityManagerpublic javax.persistence.Query createNativeQuery(String sqlString)
createNativeQuery in interface javax.persistence.EntityManagersqlString - a native SQL query string
public javax.persistence.Query createNativeQuery(String sqlString,
String resultSetMapping)
createNativeQuery in interface javax.persistence.EntityManagersqlString - a native SQL query stringresultSetMapping - the name of the result set mapping
public void joinTransaction()
This implementation throws a JpaProviderException, as it only supports resource-local operation.
joinTransaction in interface javax.persistence.EntityManagerJpaProviderException - as this impementation only supports resource-local
operation.
public void lock(Object entity,
javax.persistence.LockModeType lockMode)
lock in interface javax.persistence.EntityManagerpublic javax.persistence.EntityTransaction getTransaction()
getTransaction in interface javax.persistence.EntityManager
protected void checkAttached(Object entity)
throws IllegalArgumentException
IllegalArgumentException
protected void checkNotRemoved(Object entity)
throws IllegalArgumentException
IllegalArgumentException
protected void checkClosed()
throws IllegalStateException
IllegalStateException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||