Earn Money
Trading Forex Online
Paramount Airways
Free Data Recovery
Cargo
Job Portal
HSBC Investment
Management
Cheap Web Hosting
Make Trip
Cheap Air Travel
Leisure Hotel
Free Air Travel
Mutual Fund Informations
Cheapest Cellular Plan
Free Sexy Indians
Call Center Software
Hot Indian
|
Programming Help |
Homework Help |
Counseling
Astrology Advice |
Tarot Advice |
Parenting
Dating Advice |
Love Advice |
Divorce Advice
Legal Advice |
Debt Advice |
Career Advice
Enterprise Beans Tutorial
12
ejbFindByPrimaryKey method accepts as an argument the primary key, which it uses to locate an entity bean.
The ejbFindByPrimaryKey method may look strange to you, because it uses a primaryKey for both the
method argument and return value. However, remember that the client does not call ejbFindByPrimaryKey directly. It is the EJB container that calls the ejbFindByPrimaryKey method. The client invokes the findByPrimaryKey method, which is defined in the home interface.
The following list summarizes the rules for the finder methods that you implement in an entity bean class
with bean-managed persistence:
The ejbFindByPrimaryKey method must be implemented. A finder method name must start with the prefix ejbFind. The access control modifier must be public. The method modifier cannot be final or static. The arguments and return type must be legal types for Java RMI. The return type must be the primary key or a collection of primary keys. The throws clause may include the javax.ejb.FinderException, and other exceptions that are
specific to your application.
If a finder method returns a single primary key, it should throw the
javax.ejb.ObjectNotFoundException if the requested entity does not exist. The ObjectNotFoundException is a subclass of FinderException.
If a finder method returns a collection of primary keys, it should throw a FinderException.
The Business Methods
The business methods contain the business logic that you want to encapsulate within the entity bean. Usually, the business methods do not access the database, allowing you to separate business logic from the
database access code.
The requirements for the signature of a business method are the same for both session and entity beans:
The method name must not conflict with a method name defined by the EJB architecture. For
example, you cannot call a business method ejbCreate or ejbActivate.
The access control modifier must be public. The method modifier cannot be final or static. The arguments and return types must be legal types for Java RMI. The throws clause may include the the exceptions that you define for your application. The debit
method, for example, throws the InsufficientBalanceException. To indicate a system-level problem, a business method should throw the javax.ejb.EJBException.
Database Calls
SQL Statement in AccountEJB
Method
Resulting SQL Statement
ejbCreate
insert
ejbFindByPrimaryKey select
ejbFindByLastName select
ejbFindInRange
select
ejbLoad
select
ejbRemove
delete
ejbStore
update
Home Interface
The create methods in the home interface must conform to these requirements:
It has the same number and types of arguments as its matching ejbCreate method in the enterprise
bean class.
It returns the remote interface type of the enterprise bean.
|
|
|
Earn Money
Trading Forex Online
Paramount Airways
Free Data Recovery
Cargo
Job Portal
HSBC Investment
Management
Cheap Web Hosting
Make Trip
Cheap Air Travel
Leisure Hotel
Free Air Travel
Mutual Fund Informations
Cheapest Cellular Plan
Free Sexy Indians
Call Center Software
Hot Indian
|