public class TransactionLocalEntityCache extends Object implements ReadyEntityCache
Constructor and Description |
---|
TransactionLocalEntityCache(EntityBeanComponent component) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Object key)
Checks whether an entity bean instance for the given primary key is cached.
|
boolean |
containsNotRemoved(Object key)
Checks whether an entity bean instance for the given primary key is cached and the entity is not marked as removed.
|
void |
create(EntityBeanComponentInstance instance)
Called after an entity bean has been created and associated with a new identity.
|
void |
discard(EntityBeanComponentInstance instance)
Discard the object, called when an exception occurs
|
EntityBeanComponentInstance |
get(Object key)
Gets an entity bean instance for the given primary key.
|
void |
reference(EntityBeanComponentInstance instance) |
void |
release(EntityBeanComponentInstance instance,
boolean success)
Release the object from use.
|
void |
start()
Start the cache.
|
void |
stop()
Stop the cache.
|
public TransactionLocalEntityCache(EntityBeanComponent component)
public boolean contains(Object key)
ReadyEntityCache
contains
in interface ReadyEntityCache
key
- the identifier of the objecttrue
if the object is cached.public boolean containsNotRemoved(Object key)
ReadyEntityCache
containsNotRemoved
in interface ReadyEntityCache
key
- the identifier of the objecttrue
if the object is cached and not marked as removed.public EntityBeanComponentInstance get(Object key) throws javax.ejb.NoSuchEJBException
ReadyEntityCache
ReadyEntityCache.release(org.jboss.as.ejb3.component.entity.EntityBeanComponentInstance, boolean)
Implementors of this method must ensure that repeated calls to get within the same transaction
return the same instance for a given primary key. This must also take into account entity beans
created in the same transaction using the ReadyEntityCache.create(org.jboss.as.ejb3.component.entity.EntityBeanComponentInstance)
method.
Implementations are free to use a 1 to 1 instance -> pk mapping, or create multiple instances per
primary key.get
in interface ReadyEntityCache
key
- the identifier of the objectjavax.ejb.NoSuchEJBException
public void discard(EntityBeanComponentInstance instance)
ReadyEntityCache
discard
in interface ReadyEntityCache
instance
- The instance to discardpublic void create(EntityBeanComponentInstance instance) throws javax.ejb.NoSuchEJBException
ReadyEntityCache
create
in interface ReadyEntityCache
instance
- The new instancejavax.ejb.NoSuchEJBException
public void release(EntityBeanComponentInstance instance, boolean success)
ReadyEntityCache
release
in interface ReadyEntityCache
instance
- The entitysuccess
- True if the transaction succeededpublic void reference(EntityBeanComponentInstance instance)
public void start()
ReadyEntityCache
start
in interface ReadyEntityCache
public void stop()
ReadyEntityCache
stop
in interface ReadyEntityCache
Copyright © 2014 JBoss by Red Hat. All rights reserved.