posted 21 years ago
The state diagram shown for the entity bean lifecycle in the spec and HFE might be well-intentioned but sometimes it borders on mis-information. It is very important to think of the diagram as a conceptual model and highly summarized, not a practical and detailed state transition model. One of these days I'm going to sit down and wade through each point of the spec and draw out the real one, because the 'official' one isn't much use.
To the spec 'in the pool' simply means that there is a state, however it is implemented, where the server can use the logic in your bean class to service home methods. Instances that have been bound to specific entities are definitely not 'in the pool'; their entity-specific state bars such instances from being any help to the container in servicing home methods. Unlike with stateful session beans, in entity beans ejbPassivate and ejbActivate are really about moving beans in and out of the pool.
If it helps, think of unpooled instances are being a bit more like stateful beans because they have to service a specific need (client-specific data for a stateful bean, a specific entity's data for a stateful bean). Pooled instances are a bit like stateless beans because anything in the pool (for a given entity home) can service a home method.
I found something interesting in the spec yesterday, and I have to see if I can find the corresponding coverage in HFE. My recollection was that in HFE an entity bean instance couldn't be passivated if it was in use in some transaction. It is possible I'm mis-remembering the HFE material, but the spec definitely, very specifically says that an entity bean can be moved to the pool during a transaction.
So, getting back to your original question, in a completely insane implementation of an entity bean container you could have one bean per home doing *all* the work, with the server shifting into and out of the 'pooled' (i.e. unallocated to a specific entity) state as necessary.
[ February 17, 2004: Message edited by: Reid M. Pinchback ]
Reid - SCJP2 (April 2002)