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
3
Session Beans
·
A session bean represents a single client inside the J2EE server.
·
The client accesses remote services by invoking the session bean's methods.
·
The session bean performs work for its client, shielding the client from complexity by executing business tasks inside the server.
·
As its name suggests, a session bean is similar to an interactive session.
o
A session bean is not shared-- it may have just one client, in the same way that an interactive
session may have just one user.
o
Like an interactive session, a session bean is not persistent.
o
When the client terminates, its session bean appears to terminate and is no longer associated
with the client.
·
Session beans are powerful because they extend the reach of your clients into remote servers-- yet they're easy to build. The following section shows you how to construct a simple session bean.
Session Bean Class
The session bean must meet these requirements:
o
It implements the SessionBean interface.
o
The class is defined as public.
o
The class cannot be defined as abstract or final.
o
It implements one or more ejbCreate methods.
o
It implements the business methods.
o
It contains a public constructor with no parameters.
o
It must not define the finalize method.
The SessionBean Interface
extends the EnterpriseBean interface, which in turn extends the Serializable interface. The SessionBean interface declares the ejbRemove, ejbActivate, ejbPassivate, and setSessionContext
methods.
The Bean class, but it must implement them because they're declared in the SessionBean interface.
The ejbCreate Methods
o
Because an enterprise bean runs inside an EJB container, a client cannot directly instantiate the bean.
o
Only the EJB container can instantiate an enterprise bean.
o
During instantiation, the example program performs these steps:
o
The client invokes a create method on the home object:
o
The EJB container instantiates the enterprise bean.
o
The EJB container invokes the appropriate ejbCreate method Typically, an ejbCreate method
initializes the state of the enterprise bean.
o
An enterprise bean may have one or more ejbCreate methods. The signatures of the methods
meet the following requirements:
The access control modifier must be public.
The return type must be void.
The arguments must be legal types for Java RMI.
The modifier cannot be static or final.
The throws clause may include the javax.ejb.CreateException and other exceptions
that are specific to your application. The ejbCreate method usually throws a CreateException if an input parameter is invalid.
Business Methods
The primary purpose of a session bean is to run business tasks for the client. The client invokes business methods on the remote object reference that is returned by the create
method.
|
|
|
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
|