de.apage4u.database.bean
Class DataBaseBean

java.lang.Object
  extended byde.apage4u.database.bean.DataBaseBean
All Implemented Interfaces:
javax.ejb.EnterpriseBean, java.io.Serializable, javax.ejb.SessionBean

public class DataBaseBean
extends java.lang.Object
implements javax.ejb.SessionBean

This class contains the implementation for the `addData' method exposed by this Bean. It includes empty method bodies for the methods prescribed by the SessionBean interface; these don't need to do anything in this simple example.

See Also:
Serialized Form

Constructor Summary
DataBaseBean()
           
 
Method Summary
 void addData(java.lang.Integer id, java.lang.String title, java.lang.String artist, java.lang.String type, java.lang.String notes)
          Adds a Data to the database, if possible.
 void deleteAll()
          Deletes all Datas from the database
 void ejbActivate()
           
 void ejbCreate()
           
 void ejbPassivate()
           
 void ejbRemove()
           
 Data[] findAll()
          Returns an array of all Datas in the collection
 Data[] lookupInAnyField(java.lang.String _s)
          Returns an array of all Datas in the collection that have the specified string in any part of any field.
 void setSessionContext(javax.ejb.SessionContext sc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataBaseBean

public DataBaseBean()
Method Detail

addData

public void addData(java.lang.Integer id,
                    java.lang.String title,
                    java.lang.String artist,
                    java.lang.String type,
                    java.lang.String notes)
             throws DataExistsException,
                    java.rmi.RemoteException
Adds a Data to the database, if possible. If the Data already exists (that is, there is already an entry in the database with the same `id' field) then it throws a DataExistsException.

Throws:
DataExistsException
java.rmi.RemoteException

deleteAll

public void deleteAll()
               throws java.rmi.RemoteException
Deletes all Datas from the database

Throws:
java.rmi.RemoteException

findAll

public Data[] findAll()
               throws java.rmi.RemoteException,
                      javax.ejb.FinderException
Returns an array of all Datas in the collection

Throws:
java.rmi.RemoteException
javax.ejb.FinderException

lookupInAnyField

public Data[] lookupInAnyField(java.lang.String _s)
                        throws java.rmi.RemoteException,
                               javax.ejb.FinderException
Returns an array of all Datas in the collection that have the specified string in any part of any field. This is a very inefficient implementation: it gets the complete list of Datas as objects, then interates throw the list checking each field. This whole business could be more efficiently carried out using a big SQL `select' statement, but the whole point of Bean-managed persistence is to avoid explicit database operations.

Throws:
java.rmi.RemoteException
javax.ejb.FinderException

ejbCreate

public void ejbCreate()

ejbRemove

public void ejbRemove()
Specified by:
ejbRemove in interface javax.ejb.SessionBean

ejbActivate

public void ejbActivate()
Specified by:
ejbActivate in interface javax.ejb.SessionBean

ejbPassivate

public void ejbPassivate()
Specified by:
ejbPassivate in interface javax.ejb.SessionBean

setSessionContext

public void setSessionContext(javax.ejb.SessionContext sc)
Specified by:
setSessionContext in interface javax.ejb.SessionBean


Copyright © 2004 www.apage4u.de. All Rights Reserved.