com.caucho.amber.manager
Class AmberConnection

java.lang.Object
  extended by com.caucho.amber.manager.AmberConnection
All Implemented Interfaces:
EntityManager, Synchronization
Direct Known Subclasses:
AmberEntityManager, CacheConnection

public class AmberConnection
extends java.lang.Object
implements Synchronization, EntityManager

The entity manager from a entity manager proxy.


Method Summary
 void addCompletion(AmberCompletion completion)
          Adds a completion
 void addEntity(Entity entity)
           
 Entity addNewEntity(java.lang.Class cl, java.lang.Object key)
          Adds a new entity for the given class name and key.
 void afterCommit(boolean isCommit)
          Commits a transaction.
 void afterCompletion(int status)
          Callback after a utrans commit.
 void beforeCommit()
          Called before the commit phase
 void beforeCompletion()
          Callback before a utrans commit.
 void begin(Transaction xa)
          Callback when the user transaction begins
 void beginTransaction()
          Starts a transaction.
 void cleanup()
          Cleans up the connection.
 void clear()
          Clears the connection
 void close()
          Closes the context.
static void close(java.sql.ResultSet rs)
           
 void closeStatement(java.lang.String sql)
          Closes a statement.
 void commit()
          Commits a transaction.
 boolean contains(java.lang.Object obj)
          Loads the object based on itself.
 void create(AmberEntityHome home, java.lang.Object obj)
          Saves the object.
 void create(java.lang.Object obj)
          Saves the object.
 void create(java.lang.String homeName, java.lang.Object obj)
          Saves the object.
 Query createNamedQuery(java.lang.String name)
          Creates an instance of the named query
<T> TypedQuery<T>
createNamedQuery(java.lang.String name, java.lang.Class<T> resultClass)
          Creates a named query.
 Query createNativeQuery(java.lang.String sql)
          Creates an instance of the named query
 Query createNativeQuery(java.lang.String sql, java.lang.Class type)
          Creates an instance of the native query
 Query createNativeQuery(java.lang.String sql, java.lang.String map)
          Creates an instance of the named query
<T> TypedQuery<T>
createQuery(CriteriaQuery<T> criteriaQuery)
          Creates a TypedQuery for a criteria
 Query createQuery(java.lang.String sql)
          Creates a query.
<T> TypedQuery<T>
createQuery(java.lang.String qlString, java.lang.Class<T> resultClass)
          Creates a TypedQuery for a criteria
 void delete(Entity entity)
          Deletes the object.
 void detach()
          Detach after non-xa.
 void detach(java.lang.Object entity)
          Clears the entity
 void expire()
          Expires the entities
 void finalize()
          Finalizer.
<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<java.lang.String,java.lang.Object> properties)
          Find based on the primary key.
<T> T
find(java.lang.Class<T> entityCLass, java.lang.Object primaryKey, java.util.Map<java.lang.String,java.lang.Object> properties)
          Find based on the primary key.
 java.util.List find(java.lang.String hsql)
          Select a list of objects with a Hibernate query.
 EntityItem findEntityItem(java.lang.String name, java.lang.Object key)
          Loads the object with the given class.
 void flush()
          Flushes managed entities.
 void flushNoChecks()
          Flushes managed entities.
 void freeConnection()
          Frees the connection.
 AmberPersistenceUnit getAmberManager()
          Returns the amber manager.
 int getCacheChunkSize()
          Returns the cache chunk size.
 Entity getCacheEntity(java.lang.Class cl, java.lang.Object pk)
           
 Entity getCacheEntity(java.lang.Class cl, java.lang.Object pk, boolean isDebug)
           
 Entity getCacheEntity(Entity entity)
           
 Entity getCacheEntity(Entity entity, boolean isDebug)
           
 java.sql.Connection getConnection()
          Returns the connection.
 CriteriaBuilder getCriteriaBuilder()
          Returns a CriteriaBuilder to create CriteriaQuery objects.
 java.lang.Object getDelegate()
          Gets the delegate.
 Entity getEntity(java.lang.Class cl, java.lang.Object key)
          Matches the entity.
 Entity getEntity(Entity entity)
          Returns the context entity that corresponds to the entity passed in.
 Entity getEntity(EntityItem item)
          Returns the entity for the connection.
 Entity getEntity(int index)
           
 Entity getEntityLazy(EntityItem item)
          Returns the entity for the connection.
 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
 Metamodel getMetamodel()
          Returns the Metamodel interface for the persistence unit.
 AmberPersistenceUnit getPersistenceUnit()
          Returns the persistence unit.
 java.util.Map<java.lang.String,java.lang.Object> getProperties()
          Returns the properties for the entity manager
 ResultSetCacheChunk getQueryCacheChunk(java.lang.String sql, java.lang.Object[] args, int startRow)
          Returns the cache chunk.
 java.sql.ResultSetMetaData getQueryMetaData()
          Returns the result set meta data from cache.
<T> T
getReference(java.lang.Class<T> entityClass, java.lang.Object primaryKey)
          Find by the primary key.
 Entity getSubEntity(java.lang.Class cl, java.lang.Object key)
           
 EntityItem getSubEntityCacheItem(java.lang.Class cl, java.lang.Object key)
          Gets the cache item referenced by __caucho_item from an entity of class/subclass cl.
 EntityTransaction getTransaction()
          Returns the transaction.
 Entity getTransactionEntity(java.lang.Class cl, java.lang.Object key)
           
 Entity getTransactionEntity(int index)
           
 void initJta()
           
 void initThreadConnection()
          Set true for a threaded connection.
 boolean isActiveTransaction()
          Returns true if a transaction is active or this persistence context is extended.
 boolean isCacheEntity(Entity entity)
           
 boolean isInTransaction()
          Returns true if a transaction is active.
 boolean isJPA()
          Returns true for JPA.
 boolean isOpen()
          Returns true if open.
 void joinTransaction()
          Joins the transaction.
 java.lang.Object load(java.lang.Class cl, long intKey)
          Loads the object based on the class and primary key.
 java.lang.Object load(java.lang.Class cl, java.lang.Object key, boolean isEager)
           
 java.lang.Object load(java.lang.String entityName, java.lang.Object key)
          Loads the object based on the class and primary key.
 EntityItem loadCacheItem(java.lang.Class cl, java.lang.Object key, AmberEntityHome entityHome)
           
 Entity loadEntity(java.lang.Class cl, java.lang.Object key, boolean isEager)
          Adds a new entity for the given class name and key.
 Entity loadFromHome(java.lang.String name, java.lang.Object key)
          Loads the object with the given class.
 java.lang.Object loadLazy(java.lang.Class cl, long intKey)
          Loads the object based on the class and primary key.
 Entity loadLazy(java.lang.Class cl, java.lang.String name, java.lang.Object key)
          Loads the object with the given class.
 Entity loadLazy(java.lang.String className, java.lang.String name, java.lang.Object key)
          Loads the object with the given class.
 java.lang.Object loadProxy(EntityItem entityItem)
          Loads the CMP 2.1 object for the given entityItem
 java.lang.Object loadProxy(EntityType type, java.lang.Object key)
          Loads the object with the given class.
 java.lang.Object loadProxy(java.lang.String name, java.lang.Object key)
          Loads the object with the given class.
 void lock(java.lang.Object entity, LockModeType lockMode)
          Locks the object.
 void lock(java.lang.Object entity, LockModeType lockMode, java.util.Map<java.lang.String,java.lang.Object> properties)
          Sets the lock mode for an entity.
 java.lang.Object makePersistent(java.lang.Object obj)
          Loads the object based on itself.
<T> T
merge(T entityT)
          Merges the state of the entity into the current context.
 Entity mergeDetachedEntity(Entity newEntity)
           
 AbstractQuery parseQuery(java.lang.String sql, boolean isLazy)
          Creates a query object from a query string.
 void persist(java.lang.Object entityObject)
          Makes the instance managed.
 java.lang.Object persistFromCascade(java.lang.Object o)
          Makes the instance managed called from cascading operations.
 void popDepth()
          Pops the depth.
 java.sql.PreparedStatement prepareInsertStatement(java.lang.String sql, boolean isGeneratedId)
          Prepares an insert statement.
 AmberQuery prepareLazyQuery(java.lang.String queryString)
          Creates a query object from a query string.
 AmberQuery prepareQuery(java.lang.String queryString)
          Creates a query object from a query string.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql)
          Prepares a statement.
 AmberQuery prepareUpdate(java.lang.String queryString)
          Creates a query object from a query string.
 void pushDepth()
          Pushes the depth.
 void putQueryCacheChunk(java.lang.String sql, java.lang.Object[] args, int startRow, ResultSetCacheChunk cacheChunk, java.sql.ResultSetMetaData cacheMetaData)
          Sets the cache chunk.
 java.sql.ResultSet query(java.lang.String hsql)
          Select a list of objects with a Hibernate query.
<T> T
recursiveMerge(T entityT)
          Recursively merges the state of the entity into the current context.
 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<java.lang.String,java.lang.Object> properties)
          Update the state of the instance from the database.
 void refresh(java.lang.Object entity, java.util.Map<java.lang.String,java.lang.Object> properties)
          Update the state of the instance from the database.
 void register(AmberCollection query)
          Registers a collection.
 void remove(java.lang.Object entity)
          Remove the instance.
 boolean removeEntity(Entity entity)
          Removes an entity.
 void rollback()
          Rollbacks a transaction.
 PersistenceException rollback(java.lang.Exception e)
           
 EntityItem setEntityItem(java.lang.String name, java.lang.Object key, EntityItem item)
          Loads the object with the given class.
 void setExtended(boolean isExtended)
          Sets the extended type.
 void setFlushMode(FlushModeType mode)
          Returns the flush mode.
 void setProperty(java.lang.String propertyName, java.lang.Object value)
          Sets properties for the entity manager
 void setTransactionalState(Entity entity)
           
 void setXA(boolean isXA)
          Sets XA.
 boolean shouldRetrieveFromCache()
          Returns true when cache items can be used.
 java.lang.String toString()
           
<T> T
unwrap(java.lang.Class<T> cls)
          Returns the object of the type for a provider-specific API
 void update(Entity entity)
          Updates the object.
 void update(java.lang.Object obj)
          Updates the database with the values in object.
 int update(java.lang.String hsql)
          Updates the database with a query
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getPersistenceUnit

public AmberPersistenceUnit getPersistenceUnit()
Returns the persistence unit.


isJPA

public boolean isJPA()
Returns true for JPA.


initThreadConnection

public void initThreadConnection()
Set true for a threaded connection.


initJta

public void initJta()

persist

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

Specified by:
persist in interface EntityManager

persistFromCascade

public java.lang.Object persistFromCascade(java.lang.Object o)
Makes the instance managed called from cascading operations.


merge

public <T> T merge(T entityT)
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)
               throws EntityNotFoundException,
                      java.lang.IllegalArgumentException
Find by the primary key.

Specified by:
getReference in interface EntityManager
Throws:
EntityNotFoundException
java.lang.IllegalArgumentException

clear

public void clear()
Clears the connection

Specified by:
clear 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 name)
Creates an instance of the named query

Specified by:
createNamedQuery in interface EntityManager

createNativeQuery

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

Specified by:
createNativeQuery in interface EntityManager

createNativeQuery

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

Specified by:
createNativeQuery in interface EntityManager

createNativeQuery

public Query createNativeQuery(java.lang.String sql,
                               java.lang.Class type)
Creates an instance of the native 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

getFlushMode

public FlushModeType getFlushMode()
Returns the flush mode.

Specified by:
getFlushMode in interface EntityManager

setExtended

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


setFlushMode

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

Specified by:
setFlushMode in interface EntityManager

lock

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

Specified by:
lock in interface EntityManager

getTransaction

public EntityTransaction getTransaction()
Returns the transaction.

Specified by:
getTransaction in interface EntityManager

isOpen

public boolean isOpen()
Returns true if open.

Specified by:
isOpen 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()
Closes the context.

Specified by:
close in interface EntityManager

getAmberManager

public AmberPersistenceUnit getAmberManager()
Returns the amber manager.


register

public void register(AmberCollection query)
Registers a collection.


addCompletion

public void addCompletion(AmberCompletion completion)
Adds a completion


isActiveTransaction

public boolean isActiveTransaction()
Returns true if a transaction is active or this persistence context is extended.


isInTransaction

public boolean isInTransaction()
Returns true if a transaction is active.


getCacheChunkSize

public int getCacheChunkSize()
Returns the cache chunk size.


load

public java.lang.Object load(java.lang.Class cl,
                             java.lang.Object key,
                             boolean isEager)
                      throws AmberException
Throws:
AmberException

loadCacheItem

public EntityItem loadCacheItem(java.lang.Class cl,
                                java.lang.Object key,
                                AmberEntityHome entityHome)
                         throws AmberException
Throws:
AmberException

load

public java.lang.Object load(java.lang.String entityName,
                             java.lang.Object key)
                      throws AmberException
Loads the object based on the class and primary key.

Throws:
AmberException

getEntity

public Entity getEntity(EntityItem item)
Returns the entity for the connection.


getEntityLazy

public Entity getEntityLazy(EntityItem item)
Returns the entity for the connection.


makePersistent

public java.lang.Object makePersistent(java.lang.Object obj)
                                throws java.sql.SQLException
Loads the object based on itself.

Throws:
java.sql.SQLException

loadLazy

public Entity loadLazy(java.lang.Class cl,
                       java.lang.String name,
                       java.lang.Object key)
Loads the object with the given class.


loadLazy

public Entity loadLazy(java.lang.String className,
                       java.lang.String name,
                       java.lang.Object key)
Loads the object with the given class.


findEntityItem

public EntityItem findEntityItem(java.lang.String name,
                                 java.lang.Object key)
Loads the object with the given class.


setEntityItem

public EntityItem setEntityItem(java.lang.String name,
                                java.lang.Object key,
                                EntityItem item)
Loads the object with the given class.


loadFromHome

public Entity loadFromHome(java.lang.String name,
                           java.lang.Object key)
Loads the object with the given class.

Parameters:
name - the class name.
key - the key.

loadProxy

public java.lang.Object loadProxy(java.lang.String name,
                                  java.lang.Object key)
Loads the object with the given class.


loadProxy

public java.lang.Object loadProxy(EntityType type,
                                  java.lang.Object key)
Loads the object with the given class.


loadProxy

public java.lang.Object loadProxy(EntityItem entityItem)
Loads the CMP 2.1 object for the given entityItem


load

public java.lang.Object load(java.lang.Class cl,
                             long intKey)
                      throws AmberException
Loads the object based on the class and primary key.

Throws:
AmberException

loadLazy

public java.lang.Object loadLazy(java.lang.Class cl,
                                 long intKey)
                          throws AmberException
Loads the object based on the class and primary key.

Throws:
AmberException

getEntity

public Entity getEntity(java.lang.Class cl,
                        java.lang.Object key)
Matches the entity.


getEntity

public Entity getEntity(int index)

getEntity

public Entity getEntity(Entity entity)
Returns the context entity that corresponds to the entity passed in. The entity passed in is normally a cache entity but might be the context entity itself when we want to make sure the reference is to an entity in the persistence context.


getSubEntity

public Entity getSubEntity(java.lang.Class cl,
                           java.lang.Object key)

getSubEntityCacheItem

public EntityItem getSubEntityCacheItem(java.lang.Class cl,
                                        java.lang.Object key)
Gets the cache item referenced by __caucho_item from an entity of class/subclass cl.


getTransactionEntity

public Entity getTransactionEntity(java.lang.Class cl,
                                   java.lang.Object key)

getTransactionEntity

public Entity getTransactionEntity(int index)

addNewEntity

public Entity addNewEntity(java.lang.Class cl,
                           java.lang.Object key)
                    throws java.lang.InstantiationException,
                           java.lang.IllegalAccessException
Adds a new entity for the given class name and key. The new entity object is supposed to be used as a copy from cache. This avoids the cache entity to be added to the context.

Returns:
null - if the entity is already in the context. otherwise, it returns the new entity added to the context.
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException

loadEntity

public Entity loadEntity(java.lang.Class cl,
                         java.lang.Object key,
                         boolean isEager)
Adds a new entity for the given class name and key.


removeEntity

public boolean removeEntity(Entity entity)
Removes an entity.


contains

public boolean contains(java.lang.Object obj)
Loads the object based on itself.

Specified by:
contains in interface EntityManager

begin

public void begin(Transaction xa)
Callback when the user transaction begins


beginTransaction

public void beginTransaction()
                      throws java.sql.SQLException
Starts a transaction.

Throws:
java.sql.SQLException

setXA

public void setXA(boolean isXA)
Sets XA.


commit

public void commit()
            throws java.sql.SQLException
Commits a transaction.

Throws:
java.sql.SQLException

beforeCompletion

public void beforeCompletion()
Callback before a utrans commit.

Specified by:
beforeCompletion in interface Synchronization

afterCompletion

public void afterCompletion(int status)
Callback after a utrans commit.

Specified by:
afterCompletion in interface Synchronization

beforeCommit

public void beforeCommit()
                  throws java.sql.SQLException
Called before the commit phase

Throws:
java.sql.SQLException

afterCommit

public void afterCommit(boolean isCommit)
Commits a transaction.


rollback

public PersistenceException rollback(java.lang.Exception e)

rollback

public void rollback()
              throws java.sql.SQLException
Rollbacks a transaction.

Throws:
java.sql.SQLException

flush

public void flush()
Flushes managed entities.

Specified by:
flush in interface EntityManager

flushNoChecks

public void flushNoChecks()
Flushes managed entities.


expire

public void expire()
            throws java.sql.SQLException
Expires the entities

Throws:
java.sql.SQLException

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Returns the connection.

Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                            throws java.sql.SQLException
Prepares a statement.

Throws:
java.sql.SQLException

closeStatement

public void closeStatement(java.lang.String sql)
                    throws java.sql.SQLException
Closes a statement.

Throws:
java.sql.SQLException

close

public static void close(java.sql.ResultSet rs)

prepareInsertStatement

public java.sql.PreparedStatement prepareInsertStatement(java.lang.String sql,
                                                         boolean isGeneratedId)
                                                  throws java.sql.SQLException
Prepares an insert statement.

Throws:
java.sql.SQLException

update

public void update(java.lang.Object obj)
Updates the database with the values in object. If the object does not exist, throws an exception.

Parameters:
obj - the object to update

create

public void create(java.lang.Object obj)
            throws java.sql.SQLException
Saves the object.

Parameters:
obj - the object to create
Throws:
java.sql.SQLException

create

public void create(java.lang.String homeName,
                   java.lang.Object obj)
            throws java.sql.SQLException
Saves the object.

Parameters:
obj - the object to create
Throws:
java.sql.SQLException

create

public void create(AmberEntityHome home,
                   java.lang.Object obj)
            throws java.sql.SQLException
Saves the object.

Parameters:
obj - the object to create
Throws:
java.sql.SQLException

update

public void update(Entity entity)
Updates the object.


delete

public void delete(Entity entity)
            throws java.sql.SQLException
Deletes the object.

Parameters:
entity - the object to delete
Throws:
java.sql.SQLException

prepareQuery

public AmberQuery prepareQuery(java.lang.String queryString)
                        throws AmberException
Creates a query object from a query string.

Parameters:
queryString - a Hibernate query
Throws:
AmberException

prepareLazyQuery

public AmberQuery prepareLazyQuery(java.lang.String queryString)
                            throws AmberException
Creates a query object from a query string.

Parameters:
queryString - a Hibernate query
Throws:
AmberException

prepareUpdate

public AmberQuery prepareUpdate(java.lang.String queryString)
                         throws AmberException
Creates a query object from a query string.

Parameters:
queryString - a Hibernate query
Throws:
AmberException

parseQuery

public AbstractQuery parseQuery(java.lang.String sql,
                                boolean isLazy)
                         throws AmberException
Creates a query object from a query string.

Parameters:
sql - a Hibernate query
Throws:
AmberException

query

public java.sql.ResultSet query(java.lang.String hsql)
                         throws java.sql.SQLException
Select a list of objects with a Hibernate query.

Parameters:
hsql - the hibernate query
Returns:
the query results.
Throws:
java.sql.SQLException

getQueryCacheChunk

public ResultSetCacheChunk getQueryCacheChunk(java.lang.String sql,
                                              java.lang.Object[] args,
                                              int startRow)
Returns the cache chunk.

Parameters:
sql - the SQL for the cache chunk
args - the filled parameters for the cache chunk
startRow - the starting row for the cache chunk

getQueryMetaData

public java.sql.ResultSetMetaData getQueryMetaData()
Returns the result set meta data from cache.


putQueryCacheChunk

public void putQueryCacheChunk(java.lang.String sql,
                               java.lang.Object[] args,
                               int startRow,
                               ResultSetCacheChunk cacheChunk,
                               java.sql.ResultSetMetaData cacheMetaData)
Sets the cache chunk.

Parameters:
sql - the SQL for the cache chunk
args - the filled parameters for the cache chunk
startRow - the starting row for the cache chunk
cacheChunk - the new value of the cache chunk

update

public int update(java.lang.String hsql)
           throws java.sql.SQLException
Updates the database with a query

Parameters:
hsql - the hibernate query
Returns:
the query results.
Throws:
java.sql.SQLException

find

public java.util.List find(java.lang.String hsql)
                    throws java.sql.SQLException
Select a list of objects with a Hibernate query.

Parameters:
hsql - the hibernate query
Returns:
the query results.
Throws:
java.sql.SQLException

cleanup

public void cleanup()
Cleans up the connection.


pushDepth

public void pushDepth()
Pushes the depth.


popDepth

public void popDepth()
Pops the depth.


freeConnection

public void freeConnection()
Frees the connection.


toString

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

finalize

public void finalize()
Finalizer.

Overrides:
finalize in class java.lang.Object

shouldRetrieveFromCache

public boolean shouldRetrieveFromCache()
Returns true when cache items can be used.


setTransactionalState

public void setTransactionalState(Entity entity)

isCacheEntity

public boolean isCacheEntity(Entity entity)

getCacheEntity

public Entity getCacheEntity(Entity entity)

getCacheEntity

public Entity getCacheEntity(Entity entity,
                             boolean isDebug)

getCacheEntity

public Entity getCacheEntity(java.lang.Class cl,
                             java.lang.Object pk)

getCacheEntity

public Entity getCacheEntity(java.lang.Class cl,
                             java.lang.Object pk,
                             boolean isDebug)

detach

public void detach()
Detach after non-xa.


recursiveMerge

public <T> T recursiveMerge(T entityT)
Recursively merges the state of the entity into the current context.


mergeDetachedEntity

public Entity mergeDetachedEntity(Entity newEntity)

addEntity

public void addEntity(Entity entity)

createNamedQuery

public <T> TypedQuery<T> createNamedQuery(java.lang.String name,
                                          java.lang.Class<T> resultClass)
Description copied from interface: EntityManager
Creates a named query.

Specified by:
createNamedQuery in interface EntityManager

createQuery

public <T> TypedQuery<T> createQuery(CriteriaQuery<T> criteriaQuery)
Description copied from interface: EntityManager
Creates a TypedQuery for a criteria

Specified by:
createQuery in interface EntityManager

createQuery

public <T> TypedQuery<T> createQuery(java.lang.String qlString,
                                     java.lang.Class<T> resultClass)
Description copied from interface: EntityManager
Creates a TypedQuery for a criteria

Specified by:
createQuery in interface EntityManager

detach

public void detach(java.lang.Object entity)
Description copied from interface: EntityManager
Clears the entity

Specified by:
detach in interface EntityManager

find

public <T> T find(java.lang.Class<T> entityCLass,
                  java.lang.Object primaryKey,
                  java.util.Map<java.lang.String,java.lang.Object> properties)
Description copied from interface: EntityManager
Find based on the primary key.

Specified by:
find in interface EntityManager

find

public <T> T find(java.lang.Class<T> entityCLass,
                  java.lang.Object primaryKey,
                  LockModeType lockMode)
Description copied from interface: EntityManager
Find based on the primary key.

Specified by:
find in interface EntityManager

find

public <T> T find(java.lang.Class<T> entityCLass,
                  java.lang.Object primaryKey,
                  LockModeType lockMode,
                  java.util.Map<java.lang.String,java.lang.Object> properties)
Description copied from interface: EntityManager
Find based on the primary key.

Specified by:
find in interface EntityManager

getCriteriaBuilder

public CriteriaBuilder getCriteriaBuilder()
Description copied from interface: EntityManager
Returns a CriteriaBuilder to create CriteriaQuery objects.

Specified by:
getCriteriaBuilder in interface EntityManager

getEntityManagerFactory

public EntityManagerFactory getEntityManagerFactory()
Description copied from interface: EntityManager
Returns the owning factory

Specified by:
getEntityManagerFactory in interface EntityManager

getLockMode

public LockModeType getLockMode(java.lang.Object entity)
Description copied from interface: EntityManager
Returns the lock mode for the entity

Specified by:
getLockMode in interface EntityManager

getMetamodel

public Metamodel getMetamodel()
Description copied from interface: EntityManager
Returns the Metamodel interface for the persistence unit.

Specified by:
getMetamodel in interface EntityManager

getProperties

public java.util.Map<java.lang.String,java.lang.Object> getProperties()
Description copied from interface: EntityManager
Returns the properties for the entity manager

Specified by:
getProperties in interface EntityManager

lock

public void lock(java.lang.Object entity,
                 LockModeType lockMode,
                 java.util.Map<java.lang.String,java.lang.Object> properties)
Description copied from interface: EntityManager
Sets the lock mode for an entity.

Specified by:
lock in interface EntityManager

refresh

public void refresh(java.lang.Object entity,
                    java.util.Map<java.lang.String,java.lang.Object> properties)
Description copied from interface: EntityManager
Update the state of the instance from the database.

Specified by:
refresh in interface EntityManager

refresh

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

Specified by:
refresh in interface EntityManager

refresh

public void refresh(java.lang.Object entity,
                    LockModeType lockMode,
                    java.util.Map<java.lang.String,java.lang.Object> properties)
Description copied from interface: EntityManager
Update the state of the instance from the database.

Specified by:
refresh in interface EntityManager

setProperty

public void setProperty(java.lang.String propertyName,
                        java.lang.Object value)
Description copied from interface: EntityManager
Sets properties for the entity manager

Specified by:
setProperty in interface EntityManager

unwrap

public <T> T unwrap(java.lang.Class<T> cls)
Description copied from interface: EntityManager
Returns the object of the type for a provider-specific API

Specified by:
unwrap in interface EntityManager