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
6
·
While in the ready stage, the EJB container may decide to deactivate, or passivate, the bean by moving it from memory to secondary storage. (Typically, the EJB container uses a least-recently-used algorithm
to select a bean for passivation.)
·
The EJB container invokes the bean's ejbPassivate method immediately before passivating it.
·
If a client invokes a business method on the bean while it is in the passive stage, the EJB container activates the bean, moving it back to the ready stage, and then calls the bean's ejbActivate method
.
·
At the end of the life cycle, the client invokes the remove method and the EJB container calls the bean's ejbRemove method. The bean's instance is ready for garbage collection.
·
Your code controls the invocation of only two life cycle methods-- the create and remove methods in the client. All other methods are invoked by the EJB container. The ejbCreate method, for example, is inside the bean class, allowing you to perform certain operations right after the bean is instantiated. For instance, you may wish to connect to a database in the ejbCreate method.
The Stateless Session Bean Life Cycle
·
Because a stateless session bean is never passivated, its life cycle has just two stages: non-existent and ready for the invocation of business methods.
FIGURE 3-2 Life Cycle of a Stateless Session Bean
Comparing Session Beans
·
A client can determine if the object references of two stateful session beans are identical by invoking the isIdentical method:
bookCart = home.create("Bill Shakespeare"); videoCart = home.create("Lefty Lee"); . . . if (bookCart.isIdentical(bookCart)) { // true . . . } if (bookCart.isIdentical(videoCart)) { // false . . . }
·
Because stateless session beans have the same object identity, the isIdentical method always returns true when used to compare two such beans.
Passing a Session Bean's Object Reference
·
You can't pass the this reference, to pass a reference to itself, to another bean because the session bean is not a remote object.
·
Instead, your bean must pass an object reference for the instance. It gets the reference to itself by calling the getEJBObject method of the SessionContext interface
Accessing Environment Entries
|
|
|
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
|