Enterprise Beans Tutorial

Home| Forums | Join Google Group | Join Yahoo Group | Jobs
Get custom programming done at GetAFreelancer.com!
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


16 Container-Managed Persistence and the Primary Key Class For an entity bean with container-managed persistence, the ejbCreate method returns null. (With bean- managed persistence, it returns an instance of the primary key class.) With container-managed persistence, you do not have to write the code for the ejbFindByPrimaryKey method. Getting the Primary Key A client can fetch the primary key of an entity bean by invoking the getPrimaryKey method of the EJBObject class: account.getPrimaryKey(); The entity bean retrieves its own primary key by calling the getPrimaryKey method of the context.getPrimaryKey(); The Life Cycle of an Entity Bean The life cycle of an entity bean is controlled by the EJB container, not by your application
After the EJB container creates the instance, it calls the setEntityContext method of the entity bean class.
The setEntityContext method passes the entity context to the bean. After instantiation, the entity bean moves to a pool of available instances. While in the pooled stage, the instance is not associated with any particular EJB object identity. All instances in the pool are identical.
The EJB container assigns an identity to an instance when moving it to the ready stage.
There are two paths from the pooled stage to the ready stage. On the first path, the client invokes the create method, causing the EJB container to call the ejbCreate and ejbPostCreate methods. On the second path,
the EJB container invokes the ejbActivate method. While in the ready stage, an entity bean's business
methods may be invoked.
There are also two paths from the ready stage to the pooled stage. First, a client may invoke the remove method, which causes the EJB container to call the ejbRemove method. Second, the EJB container may
invoke the ejbPassivate method.
At the end of the life cycle, the EJB container removes the instance from the pool and invokes the unsetEntityContext method. FIGURE 4-1 Life Cycle of an Entity Bean In the pooled state, an instance is not associated with any particular EJB object identity.


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