alt
Advertisement
Sponsored links
Certification Series
Online Training
Career Series
Exforsys
Exforsys arrow Certification Series arrow SCBCD arrow SCBCD Study Notes : Chapter 5 : Client View of an Entity (Part 2)
Site Search


SCBCD Study Notes : Chapter 5 : Client View of an Entity (Part 2)
Article Index
SCBCD Study Notes : Chapter 5 : Client View of an Entity (Part 2)
Page 2

.

.

LOCAL view CMP Entity EJB

An entity bean’s local home interface defines ONE (findByPrimaryKey(primaryKey) method is MANDATORY for all Entity Beans) or MORE finder methods. The name of each finder method starts with the prefix “find”. The return type of a finder method on the local home interface MUST be the entity bean’s LOCAL interface, or a type representing a collection (java.util.Collection or java.util.Set) of objects that implement the entity bean’s LOCAL interface.

The throws clause of EVERY finder method on the LOCAL HOME interface includes the javax.ejb.FinderException. The throws clause MUST NOT include the java.rmi.RemoteException.

The local home interface includes the findByPrimaryKey(primaryKey) method, which allows a client to locate an entity object using a primary key. The name of the method is always findByPrimaryKey; it has a single argument that is the SAME type as the entity bean’s primary key type, and its return type is the entity bean’s LOCAL INTERFACE. There is a unique findByPrimaryKey(primaryKey) method for an entity bean on its local home interface; this method MUST NOT be overloaded.

;;;;;; ;;;;;; ;;;;;; ;;;;;; ;;;;;; ;;;;;; ;;;;;; ;;;;;; ;;;;;; ;;;;;; ;;;;;;;;
public interface AccountHome extends javax.ejb.EJBLocalHome { ;;;;;;;;;;;;;;;;
;;;;;;... ;;;;;; ;;;;;; ;;;;;; ;;;;;; ;;;;;; ;;;;;; ;;;;;; ;;;;;; ;;;;;;;;;;;;
;;;;;;public Account findByPrimaryKey(String AccountNumber) ;;;;;; ;;;;;;;;;;
;;;;;; ;;;;;;throws FinderException; ;;;;;; ;;;;;; ;;;;;; ;;;;;;;;;;;;;;;;;;;
} ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
AccountHome = ...; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Account account = accountHome.findByPrimaryKey(“100-3450-3333”);;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

An entity bean’s local home interface can define ZERO or MORE create< METHOD >(...) methods. The name of each create method starts with the prefix “create”.

The return type of a create< METHOD > method on the LOCAL HOME interface is the entity bean’s LOCAL interface.

The throws clause of EVERY create< METHOD > method on the LOCAL HOME interface includes the javax.ejb.CreateException. It MAY include additional application-level exceptions. It MUST NOT include the java.rmi.RemoteException.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
public interface AccountHome extends javax.ejb.EJBLocalHome {;;;;;;;;;;;;;;;;;
;;;;;;;public Account create(String firstName, String lastName,;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;double initialBalance);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;throws CreateException;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;public Account create(String accountNumber,;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;double initialBalance);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;throws CreateException, LowInitialBalanceException;
;;;;;;
;;;;;;;public Account createLargeAccount(String firstname,;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;String lastname, double initialBalance);;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;throws CreateException;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;...;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
AccountHome accountHome = ...;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Account account = accountHome.create(“John”, “Smith”, 500.00);;;;;;;;;;;;;;;ll

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

The javax.ejb.EJBLocalHome interface defines the REMOVE method to allow the client to remove an entity object (NOTE, local objects do NOT have handles).

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
public interface EJBLocalHome {;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;void remove(Object primaryKey) throws RemoveException,;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;EJBException;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

After an entity object has been removed, subsequent attempts to access the local entity object by the local client result in the javax.ejb.NoSuchObjectLocalException.

An entity bean’s local home interface MAY define one or more HOME METHODS. Home methods are methods that the bean provider supplies for business logic that is NOT specific to an entity bean instance. They MUST NOT start with “create”, “find”, or “remove”.

The throws clause of a home method on the local home interface MAY include additional application-level exceptions. It MUST NOT include the java.rmi.RemoteException.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Public interface EmployeeHome extends javax.ejb.EJBLocalHome {;;;;;;;;;;;;;;;;
;;;;;;;...;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;// this method returns a living index depending on;;;;;;;;;;;;;;;;;;;;;
;;;;;;;// the state and the base salary of an employee:;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;// the method is not specific to an instance;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;public float livingIndex(String state, float Salary);;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;// this method adds a bonus to all of the employees;;;;;;;;;;;;;;;;;;;;
;;;;;;;// based on a company profit sharing index;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;public void addBonus(float company_share_index);;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;throws ShareIndexOutOfRangeException;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;...;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

__________________
Author: Mikalai Zaikin. Please Click Here to visit Authors site for any updates and changes to the study notes.

 

 

 


Trackback(0)
Comments (0)add comment

Write comment

busy

 
< Prev   Next >
Exforsys Offers
© 2008 Exforsys.com
Joomla! is Free Software released under the GNU/GPL License.
Page copy protected against web site content infringement by Copyscape