aspose file tools
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes ejb lifecycle question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Architect Certification (SCEA/OCMJEA)
Reply Bookmark "ejb lifecycle question" Watch "ejb lifecycle question" New topic
Author

ejb lifecycle question

Timber Lee
Ranch Hand

Joined: Oct 14, 2002
Posts: 157
please see a state diagram for entity bean from http://www.kevinboone.com/ejb-lifecycles.html .
I have some questions about it.
1. are the beans in state of the Passive not maped to any item of database?
2. what situations let container build a new bean in state of the Passive?


SCJP<br />SCWCD<br />SCEA
Thomas Taeger
Ranch Hand

Joined: Dec 16, 2002
Posts: 307
Hi Timber,
Originally posted by Timber Lee:
1. are the beans in state of the Passive not maped to any item of database?

Shouldn't for entity EJBs the state be called "pooled" instead of "passive"?
The Entity Bean's Instance Lifecycle consists of the states:
- does not exist
- pooled
- ready
The Client's View of an Entity Beans's Lifecycle consits of the states:
- Does not exist and not referenced
- Does not exist and referenced
- Exists and not referenced
- Exists and referenced.
As far as I know in the pooled (not "passive") state you find two kinds of Entity Beans:
a. Instance still without identity (only newInstance() and setEntityContext() have been done).
- - Usable for any find...(), not for ejbActivate().
- - As long as they have no ID they are not mapped to a database/EIS entity.
b. Instance got an identity (primary key) by find...() and
- - thereby has been mapped to a database/EIS entity, and
- - member variables
- - - have been populated from database/EIS before ejbPassivate(),
- - - - i.e.have been mapped to column field values, _OR_
- - - have not yet been populated by a database load
- - - - (never have bean in ready state for the current pk),
- - - - i.e have not been mapped to column field values yet.
- - Instance is reusable for
- - - ejbActivate() (from swap file)
- - - - if it had been swapped out on passivate(), _OR_
- - - any other find() resulting in an other primary key and identity.
- - - - Member variables become invalid, and
- - - - are no longer mapped to column field values.

Originally posted by Timber Lee:
2. what situations let container build a new bean in state of the Passive?

In the state of pooled (not "passive") never a new entity bean is (or needs to be) created for this database/EIS entity, only from state "does not exist", or again after having freed that resource by unsetEntityContext().
Literature: R. Adatia et al.: "Professional EJB", page 126 .. 128.
Hope I am right,
Thomas.


www.classic-and-class.com - www.evalulearn.com
Interfaces are the glue of OO.
 
 
subject: ejb lifecycle question
 
Threads others viewed
ejbRemove In Session Bean
Transaction in EJB
what exactly setting a classpath means?
does ejbRemove() ever called on stateful bean?
Difference between CMT and BMT
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture