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
14
o
Reference of a remote interface
o
A container-managed field must be public and may not be defined as transient.
The ejbCreate Method
The ejbCreate method initializes the container-managed fields from the input parameters. The method returns null because with container-managed persistence the container ignores its return value. After the ejbCreate method executes, the container inserts the container-manged fields into the database.
The ejbRemove Method
o
When the client invokes the remove method, the container calls the ejbRemove method.
o
After the ejbRemove method returns, the container deletes the row from the database.
o
If the container fails to delete the row, it throws an exception.
o
If an entity bean needs to perform some operation immediately before removal, it should do so in the
ejbRemove method.
The ejbLoad Method
When the container needs to refresh the entity bean's state from the database, it performs these steps:
o
Selects the row from the database
o
Assigns the row's column values to the container-manged fields
o
Invokes the ejbLoad method
o
Usually, the ejbLoad method is empty. The entity bean may use the ejbLoad method, however, to
transform the values read from the database. For example, the ejbLoad method might uncompress text data so that it can be manipulated by the business methods.
The ejbStore Method
When the container needs to save the entity bean's state in the database, it performs these steps:
o
Invokes the ejbStore method
o
Gets the values of the container-managed fields
o
Updates the row in the database with the values of the container-managed fields
o
Like the ejbLoad method, the ejbStore method is typically empty. But if you need to transform
container-managed fields before the container stores them in the database, you should do so in the ejbStore method. For example, the ejbStore method might compress text data before the container stores it in the database.
Handling Exceptions
The exceptions thrown by enterprise beans fall into two categories: system and application.
·
A system exception indicates a problem with the services that support an application.
o
Examples of these problems include the following: a database connection cannot be obtained, a
SQL insert fails because the database is full, a lookup method cannot find the desired object.
o
If your enterprise bean encounters a sytem-level problem, it should throw a
javax.ejb.EJBException. The container will wrap the EJBException in a RemoteException, which it passes back to the client.
o
Because the EJBException is a subclass of the RuntimeException, you do not have to specify
it in the throws clause of the method declaration.
o
If a system exception is thrown, the EJB container might destroy the bean instance. Therefore,
a system exception cannot be handled by the bean's client program; it requires intervention by a system administrator.
An application exception signals an error in the business logic of an enterprise bean.
There are two types of application exceptions: customized and predefined.
|
|
|
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
|