Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

B32476-03

oracle.toplink.ejb
Class EJBDataStore

java.lang.Object
  extended by oracle.toplink.ejb.EJBDataStore

public class EJBDataStore
extends java.lang.Object

Purpose: Implement the EJB entity bean BMP/CMP APIs.

Description: This class maps the EJB entity bean APIs to TopLink APIs. It can be used from a BMP base class or from a CMP persister in compatible EJB servers.

Responsibilities:

Since:
TOPLink/Java 3.0

Constructor Summary
EJBDataStore()
          Create a new data store.
 
Method Summary
 java.lang.Object create(javax.ejb.EntityBean bean)
          Insert the bean into the database.
 java.lang.Object create(java.lang.Object bean)
          Insert the bean into the database.
 java.util.Collection ejb20FindAll()
          Read all the objects for the class and load them into the cache.
 java.util.Collection ejb20FindAll(Call call)
          Read all the objects for the class given the call and load them into the cache.
 java.util.Collection ejb20FindAll(Expression expression)
          Read all the objects for the class given the expression and load them into the cache.
 java.util.Collection ejb20FindAll(ReadAllQuery query)
          Read all the objects for the class given the query and load them into the cache.
 java.util.Collection ejb20FindAllByNamedQuery(java.lang.String queryName, java.util.Vector arguments)
          Read all the objects for the class given the query and load them into the cache.
 java.util.Enumeration findAll()
          Read all the objects for the class and load them into the cache.
 java.util.Enumeration findAll(Call call)
          Read all the objects for the class given the call and load them into the cache.
 java.util.Enumeration findAll(Expression expression)
          Read all the objects for the class given the expression and load them into the cache.
 java.util.Enumeration findAll(ReadAllQuery query)
          Read all the objects for the class given the query and load them into the cache.
 java.util.Enumeration findAllByNamedQuery(java.lang.String queryName, java.util.Vector arguments)
          Read all the objects for the class given the query and load them into the cache.
 java.util.Vector findAllObjects(ReadAllQuery query)
          Read all the objects for the class given the query and load them into the cache.
 java.util.Vector findAllObjectsByNamedQuery(java.lang.String queryName, java.util.Vector arguments)
          Read all the objects for the class given the query and load them into the cache.
 java.lang.Object findByPrimaryKey(java.lang.Object primaryKeyObject)
          Find the object by primary key object and load it into the cache.
 java.lang.Object findObject(ReadObjectQuery query)
          Find the object by the query and load it into the cache.
 java.lang.Object findObjectByNamedQuery(java.lang.String queryName, java.util.Vector arguments)
          Find the object by the query and load it into the cache.
 java.lang.Object findOne(Call call)
          Find the object by the query and load it into the cache.
 java.lang.Object findOne(Expression expression)
          Find the object by the query and load it into the cache.
 java.lang.Object findOne(ReadObjectQuery query)
          Find the object by the query and load it into the cache.
 java.lang.Object findOneByNamedQuery(java.lang.String queryName, java.util.Vector arguments)
          Find the object by the query and load it into the cache.
 oracle.toplink.internal.sessions.AbstractSession getActiveSession()
          Return the session or unit of work if in a transaction.
 oracle.toplink.internal.sessions.UnitOfWorkImpl getActiveUnitOfWork()
          Return the unit of work in the transaction context.
 java.lang.Class getBeanClass()
          Return the bean class.
 oracle.toplink.internal.sessions.AbstractSession getSession()
          ADVANCED: Return the session.
 java.lang.String getSessionName()
          Return the session name.
 XMLSessionConfigLoader getXMLSessionConfigLoader()
          Return the XMLSessionConfigLoader for this datastore.
 void load(java.lang.Object bean)
          Load from the database/cache into the object.
 void remove(javax.ejb.EntityBean bean)
          Delete the bean from the database.
 void remove(java.lang.Object bean)
          Delete the bean from the database.
 void setBeanClass(java.lang.Class beanClass)
          REQUIRED: Set the bean class for the data store.
 void setSession(Session session)
          Set the session.
 void setSessionName(java.lang.String sessionName)
          Set the session name.
 void setXMLSessionConfigLoader(XMLSessionConfigLoader xmlSessionConfigloader)
          Set the XMLSessionConfigLoader that will be used to load the session configuration information.
 void store(javax.ejb.EntityBean bean)
          Update the bean into the database.
 void store(java.lang.Object bean)
          Update the bean into the database.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EJBDataStore

public EJBDataStore()
Create a new data store. By default use the default session.

Method Detail

create

public java.lang.Object create(java.lang.Object bean)
                        throws javax.ejb.CreateException
Insert the bean into the database. This registers it with the active unit of work for insertion on commit. If using sequencing (not sybase natvie) the sequence number will be assigned.

Throws:
javax.ejb.CreateException

create

public java.lang.Object create(javax.ejb.EntityBean bean)
                        throws javax.ejb.CreateException
Insert the bean into the database.

Throws:
javax.ejb.CreateException

findAll

public java.util.Enumeration findAll()
                              throws javax.ejb.FinderException
Read all the objects for the class and load them into the cache. Return an enumeration on the primary key objects as per the BMP spec.

Throws:
javax.ejb.FinderException

ejb20FindAll

public java.util.Collection ejb20FindAll()
                                  throws javax.ejb.FinderException
Read all the objects for the class and load them into the cache. Return a Collection on the primary key objects as per the BMP 2.0 spec.

Throws:
javax.ejb.FinderException

findAll

public java.util.Enumeration findAll(Expression expression)
                              throws javax.ejb.FinderException
Read all the objects for the class given the expression and load them into the cache. Return an enumeration on the primary key objects as per the BMP spec.

Throws:
javax.ejb.FinderException

ejb20FindAll

public java.util.Collection ejb20FindAll(Expression expression)
                                  throws javax.ejb.FinderException
Read all the objects for the class given the expression and load them into the cache. Return a Collection on the primary key objects as per the BMP 2.0 spec.

Throws:
javax.ejb.FinderException

findAll

public java.util.Enumeration findAll(Call call)
                              throws javax.ejb.FinderException
Read all the objects for the class given the call and load them into the cache. Return an enumeration on the primary key objects as per the BMP spec.

Throws:
javax.ejb.FinderException

ejb20FindAll

public java.util.Collection ejb20FindAll(Call call)
                                  throws javax.ejb.FinderException
Read all the objects for the class given the call and load them into the cache. Return a Collection on the primary key objects as per the BMP 2.0 spec.

Throws:
javax.ejb.FinderException

findAll

public java.util.Enumeration findAll(ReadAllQuery query)
                              throws javax.ejb.FinderException
Read all the objects for the class given the query and load them into the cache. Return an enumeration on the primary key objects as per the BMP spec.

Throws:
javax.ejb.FinderException

ejb20FindAll

public java.util.Collection ejb20FindAll(ReadAllQuery query)
                                  throws javax.ejb.FinderException
Read all the objects for the class given the query and load them into the cache. Return a Collection on the primary key objects as per the BMP 2.0spec.

Throws:
javax.ejb.FinderException

findAllByNamedQuery

public java.util.Enumeration findAllByNamedQuery(java.lang.String queryName,
                            java.util.Vector arguments)
                                          throws javax.ejb.FinderException
Read all the objects for the class given the query and load them into the cache. Return an enumeration on the primary key objects as per the BMP spec.

Throws:
javax.ejb.FinderException

ejb20FindAllByNamedQuery

public java.util.Collection ejb20FindAllByNamedQuery(java.lang.String queryName,
                                 java.util.Vector arguments)
                                              throws javax.ejb.FinderException
Read all the objects for the class given the query and load them into the cache. Return a Collection on the primary key objects as per the BMP 2.0 spec.

Throws:
javax.ejb.FinderException

findAllObjects

public java.util.Vector findAllObjects(ReadAllQuery query)
                                throws javax.ejb.FinderException
Read all the objects for the class given the query and load them into the cache. Return a vector of the objects.

Throws:
javax.ejb.FinderException

findAllObjectsByNamedQuery

public java.util.Vector findAllObjectsByNamedQuery(java.lang.String queryName,
                                   java.util.Vector arguments)
                                            throws javax.ejb.FinderException
Read all the objects for the class given the query and load them into the cache. Return a vector of the objects.

Throws:
javax.ejb.FinderException

findByPrimaryKey

public java.lang.Object findByPrimaryKey(java.lang.Object primaryKeyObject)
                                  throws javax.ejb.FinderException
Find the object by primary key object and load it into the cache. Throw object not found if null, otherwise return the primary key.

Throws:
javax.ejb.FinderException

findObject

public java.lang.Object findObject(ReadObjectQuery query)
                            throws javax.ejb.FinderException
Find the object by the query and load it into the cache. If object not found return null, otherwise return the object.

Throws:
javax.ejb.FinderException

findObjectByNamedQuery

public java.lang.Object findObjectByNamedQuery(java.lang.String queryName,
                                               java.util.Vector arguments)
                                        throws javax.ejb.FinderException
Find the object by the query and load it into the cache. If object not found return null, otherwise return the object.

Throws:
javax.ejb.FinderException

findOne

public java.lang.Object findOne(Expression expression)
                         throws javax.ejb.FinderException
Find the object by the query and load it into the cache. Throw object not found if null, otherwise return the primary key.

Throws:
javax.ejb.FinderException

findOne

public java.lang.Object findOne(Call call)
                         throws javax.ejb.FinderException
Find the object by the query and load it into the cache. Throw object not found if null, otherwise return the primary key.

Throws:
javax.ejb.FinderException

findOne

public java.lang.Object findOne(ReadObjectQuery query)
                         throws javax.ejb.FinderException
Find the object by the query and load it into the cache. Throw object not found if null, otherwise return the primary key.

Throws:
javax.ejb.FinderException

findOneByNamedQuery

public java.lang.Object findOneByNamedQuery(java.lang.String queryName,
                                            java.util.Vector arguments)
                                     throws javax.ejb.FinderException
Find the object by the query and load it into the cache. Throw object not found if null, otherwise return the primary key.

Throws:
javax.ejb.FinderException

getActiveSession

public oracle.toplink.internal.sessions.AbstractSession getActiveSession()
Return the session or unit of work if in a transaction.


getActiveUnitOfWork

public oracle.toplink.internal.sessions.UnitOfWorkImpl getActiveUnitOfWork()
Return the unit of work in the transaction context.


getBeanClass

public java.lang.Class getBeanClass()
Return the bean class.


getSession

public oracle.toplink.internal.sessions.AbstractSession getSession()
ADVANCED: Return the session. The ClassLoader for this session will be extracted from the bean Class.


getSessionName

public java.lang.String getSessionName()
Return the session name. This session name is used to lookup the session. By default it is default.


getXMLSessionConfigLoader

public XMLSessionConfigLoader getXMLSessionConfigLoader()
Return the XMLSessionConfigLoader for this datastore.


load

public void load(java.lang.Object bean)
Load from the database/cache into the object. It is assumed the bean has its' key set. Runtime exceptions are thrown as load does not define any exception.


remove

public void remove(java.lang.Object bean)
            throws javax.ejb.RemoveException
Delete the bean from the database.

Throws:
javax.ejb.RemoveException

remove

public void remove(javax.ejb.EntityBean bean)
            throws javax.ejb.RemoveException
Delete the bean from the database.

Throws:
javax.ejb.RemoveException

setBeanClass

public void setBeanClass(java.lang.Class beanClass)
REQUIRED: Set the bean class for the data store.


setSession

public void setSession(Session session)
Set the session. By default it is looked up through the session name or the default session is used.


setSessionName

public void setSessionName(java.lang.String sessionName)
Set the session name. This session name is used to lookup the session. By default it is default.


setXMLSessionConfigLoader

public void setXMLSessionConfigLoader(XMLSessionConfigLoader xmlSessionConfigloader)
Set the XMLSessionConfigLoader that will be used to load the session configuration information. By default it is it is the core loader.


store

public void store(java.lang.Object bean)
           throws DatabaseException,
                  OptimisticLockException
Update the bean into the database. Note, runtime exceptions are thrown as store defines no exception. This uses the unit of work merge to update the TopLink version of the object.

Throws:
DatabaseException
OptimisticLockException

store

public void store(javax.ejb.EntityBean bean)
           throws DatabaseException,
                  OptimisticLockException
Update the bean into the database. Note, runtime exceptions are thrown as store defines no exception. Store must always be an update, so update is called, not write object.

Throws:
DatabaseException
OptimisticLockException

Copyright © 1998, 2010, Oracle. All Rights Reserved.