Obtaining a reference to a local bean

Discussions

EJB programming & troubleshooting: Obtaining a reference to a local bean

  1. Obtaining a reference to a local bean (3 messages)

    Given a Stateful Session Bean that is exposed only localy (i.e only EJBLocalHome and EJBLocalObject are defined)
    is there a way to find a particular instance of the bean from a client that does not have
    a refernce to to the bean's local object.
    Obviously the client and the bean are on the same VM.

    This can be done for a remote enabled bean by serealizing the bean's handle which is available from the EJBObject.

    There is nothing similar on the EJBLocalObject interface.

    Any ideas?
  2. Obtaining a reference to a local bean[ Go to top ]

    I think I didn't get your question... For remote beans you can serialize the reference/handle. For local beans you simply pass the reference using normal Java semantics... What is the problem?

    Gal
  3. Obtaining a reference to a local bean[ Go to top ]

    I'd like a message driven bean (which I know to be colocated) to be able to communicate with that specific instance of a stateful session bean. This is possible with remote interfaces. My question concerns local ones.

    David
  4. Obtaining a reference to a local bean[ Go to top ]

    What you are asking to do is to access the actual same instance from the MDB. This is not possible. Had you used remote interfaces, you could pass the remote ref. But this does not denote an actual instance - it denotes an entity. The container decides which instance will be associated with that entity in a specific point in time.

    Passing something like a handle would not make sense, because on every VM you open the handle you will need a seperate local instance anyway. If you want your MDB to access a local instance representing an entity, pass it the PK.

    Regards
    Gal