com.caucho.amber.manager
Class EntityManagerProxy

java.lang.Object
  extended by com.caucho.amber.manager.EntityManagerProxy
All Implemented Interfaces:
HandleAware, java.io.Serializable, EntityManager

public class EntityManagerProxy
extends java.lang.Object
implements EntityManager, java.io.Serializable, HandleAware

The Entity manager

See Also:
Serialized Form

Constructor Summary
EntityManagerProxy(AmberPersistenceUnit persistenceUnit)
           
 
Method Summary
 void clear()
          Clears the manager.
 void clear(java.lang.Object entity)
          Clears the entity
 void close()
          Clears the manager.
 boolean contains(java.lang.Object entity)
          Returns true if the entity belongs to the current context.
 Query createNamedQuery(java.lang.String sql)
          Creates an instance of the named query
 Query createNativeQuery(java.lang.String sql)
          Creates a query.
 Query createNativeQuery(java.lang.String sql, java.lang.Class retType)
          Creates a query.
 Query createNativeQuery(java.lang.String sql, java.lang.String map)
          Creates a query.
 Query createQuery(java.lang.String sql)
          Creates a query.
<T> T
find(java.lang.Class<T> entityClass, java.lang.Object primaryKey)
          Find by the primary key.
<T> T
find(java.lang.Class<T> entityCLass, java.lang.Object primaryKey, LockModeType lockMode)
          Find based on the primary key.
<T> T
find(java.lang.Class<T> entityCLass, java.lang.Object primaryKey, LockModeType lockMode, java.util.Map properties)
          Find based on the primary key.
 void flush()
          Synchronize with the database.
 java.lang.Object getDelegate()
          Gets the delegate.
 EntityManagerFactory getEntityManagerFactory()
          Returns the owning factory
 FlushModeType getFlushMode()
          Returns the flush mode.
 LockModeType getLockMode(java.lang.Object entity)
          Returns the lock mode for the entity
 java.util.Map getProperties()
          Returns the properties for the entity manager
<T> T
getReference(java.lang.Class<T> entityClass, java.lang.Object primaryKey)
          Find by the primary key.
 java.util.Set<java.lang.String> getSupportedProperties()
          Returns the supported properties for the entity manager
 EntityTransaction getTransaction()
          Returns the entity manager transaction.
 boolean isOpen()
          Returns true if open.
 void joinTransaction()
          Joins the transaction.
 void lock(java.lang.Object entity, LockModeType lockMode)
          Locks the object.
 void lock(java.lang.Object entity, LockModeType lockMode, java.util.Map properties)
          Sets the lock mode for an entity.
<T> T
merge(T entity)
          Merges the state of the entity into the current context.
 void persist(java.lang.Object entity)
          Makes the instance managed.
 void refresh(java.lang.Object entity)
          Refresh the state of the instance from the database.
 void refresh(java.lang.Object entity, LockModeType lockMode)
          Update the state of the instance from the database.
 void refresh(java.lang.Object entity, LockModeType lockMode, java.util.Map properties)
          Update the state of the instance from the database.
 void remove(java.lang.Object entity)
          Remove the instance.
 void setExtended(boolean isExtended)
          Sets the extended type.
 void setFlushMode(FlushModeType mode)
          Sets the flush mode.
 void setSerializationHandle(java.lang.Object handle)
          Serialization handle
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EntityManagerProxy

public EntityManagerProxy(AmberPersistenceUnit persistenceUnit)
Method Detail

persist

public void persist(java.lang.Object entity)
Makes the instance managed.

Specified by:
persist in interface EntityManager

merge

public <T> T merge(T entity)
Merges the state of the entity into the current context.

Specified by:
merge in interface EntityManager

remove

public void remove(java.lang.Object entity)
Remove the instance.

Specified by:
remove in interface EntityManager

find

public <T> T find(java.lang.Class<T> entityClass,
                  java.lang.Object primaryKey)
Find by the primary key.

Specified by:
find in interface EntityManager

getReference

public <T> T getReference(java.lang.Class<T> entityClass,
                          java.lang.Object primaryKey)
Find by the primary key.

Specified by:
getReference in interface EntityManager

getFlushMode

public FlushModeType getFlushMode()
Returns the flush mode.

Specified by:
getFlushMode in interface EntityManager

setFlushMode

public void setFlushMode(FlushModeType mode)
Sets the flush mode.

Specified by:
setFlushMode in interface EntityManager

setExtended

public void setExtended(boolean isExtended)
Sets the extended type.


lock

public void lock(java.lang.Object entity,
                 LockModeType lockMode)
Locks the object.

Specified by:
lock in interface EntityManager

clear

public void clear()
Clears the manager.

Specified by:
clear in interface EntityManager

flush

public void flush()
Synchronize with the database.

Specified by:
flush in interface EntityManager

joinTransaction

public void joinTransaction()
Joins the transaction.

Specified by:
joinTransaction in interface EntityManager

getDelegate

public java.lang.Object getDelegate()
Gets the delegate.

Specified by:
getDelegate in interface EntityManager

close

public void close()
Clears the manager.

Specified by:
close in interface EntityManager

createQuery

public Query createQuery(java.lang.String sql)
Creates a query.

Specified by:
createQuery in interface EntityManager

createNamedQuery

public Query createNamedQuery(java.lang.String sql)
Creates an instance of the named query

Specified by:
createNamedQuery in interface EntityManager

createNativeQuery

public Query createNativeQuery(java.lang.String sql)
Creates a query.

Specified by:
createNativeQuery in interface EntityManager

createNativeQuery

public Query createNativeQuery(java.lang.String sql,
                               java.lang.String map)
Creates a query.

Specified by:
createNativeQuery in interface EntityManager

createNativeQuery

public Query createNativeQuery(java.lang.String sql,
                               java.lang.Class retType)
Creates a query.

Specified by:
createNativeQuery in interface EntityManager

refresh

public void refresh(java.lang.Object entity)
Refresh the state of the instance from the database.

Specified by:
refresh in interface EntityManager

contains

public boolean contains(java.lang.Object entity)
Returns true if the entity belongs to the current context.

Specified by:
contains in interface EntityManager

getTransaction

public EntityTransaction getTransaction()
Returns the entity manager transaction.

Specified by:
getTransaction in interface EntityManager

isOpen

public boolean isOpen()
Returns true if open.

Specified by:
isOpen in interface EntityManager

find

public <T> T find(java.lang.Class<T> entityCLass,
                  java.lang.Object primaryKey,
                  LockModeType lockMode)
Find based on the primary key.

Specified by:
find in interface EntityManager
Since:
JPA 2.0

find

public <T> T find(java.lang.Class<T> entityCLass,
                  java.lang.Object primaryKey,
                  LockModeType lockMode,
                  java.util.Map properties)
Find based on the primary key.

Specified by:
find in interface EntityManager
Since:
JPA 2.0

lock

public void lock(java.lang.Object entity,
                 LockModeType lockMode,
                 java.util.Map properties)
Sets the lock mode for an entity.

Specified by:
lock in interface EntityManager
Since:
JPA 2.0

refresh

public void refresh(java.lang.Object entity,
                    LockModeType lockMode)
Update the state of the instance from the database.

Specified by:
refresh in interface EntityManager
Since:
JPA 2.0

refresh

public void refresh(java.lang.Object entity,
                    LockModeType lockMode,
                    java.util.Map properties)
Update the state of the instance from the database.

Specified by:
refresh in interface EntityManager
Since:
JPA 2.0

clear

public void clear(java.lang.Object entity)
Clears the entity

Specified by:
clear in interface EntityManager
Since:
JPA 2.0

getLockMode

public LockModeType getLockMode(java.lang.Object entity)
Returns the lock mode for the entity

Specified by:
getLockMode in interface EntityManager
Since:
JPA 2.0

getProperties

public java.util.Map getProperties()
Returns the properties for the entity manager

Specified by:
getProperties in interface EntityManager
Since:
JPA 2.0

getSupportedProperties

public java.util.Set<java.lang.String> getSupportedProperties()
Returns the supported properties for the entity manager

Specified by:
getSupportedProperties in interface EntityManager
Since:
JPA 2.0

getEntityManagerFactory

public EntityManagerFactory getEntityManagerFactory()
Returns the owning factory

Specified by:
getEntityManagerFactory in interface EntityManager
Since:
JPA 2.0

setSerializationHandle

public void setSerializationHandle(java.lang.Object handle)
Serialization handle

Specified by:
setSerializationHandle in interface HandleAware

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object