Why do bean classes need access to homes and objects

Nirmala Rayudu

Greenhorn

Posts: 14

posted 12 years ago

Spec makes a big deal about which of the lifecycle and container callback methods of a bean class can call (getEJBHome, getEJBObject, getEJBLocalHome, getEJBLocalObject) methods on their corresponding contexts(SessionContext, EntityContext or MessageDrivenContext). I do not understand why a bean class instance would need to access its home and component interfaces? Would anyony who has any idea/example of this, please share it?

Thanks

Nadeem Awad

Ranch Hand

Posts: 74

posted 12 years ago

I'm not sure about the following, but this is what came to my mind:

If you want to create another bean of the same type from within the bean class (I don't know why would you wanna do that! ). You have to do it using the home interface by calling the getEJBHome() method.

If you want to pass a reference of the bean to another bean, you can't pass this as a parameter. You're only allowed to pass your bean's EJBObject.