Local interface for a stateful Session EJB

Discussions

EJB design: Local interface for a stateful Session EJB

  1. Local interface for a stateful Session EJB (1 messages)

    Hello,

    I have a question regarding correct use of stateful beans.

    In my design, a Stateful Bean is used only by stateless session beans, and therefore it seems like it makes sense to equip that stateful bean with a local interface.

    On the other hand, the handle to that stateful bean must be stored on the (potentially remote) servlet controller, which means that it needs a remote interface, at least remote home interface, which, according to J2EE tutorial, comes with a remote business interface.

    Again, if I store a handle to that stateful bean on the servlet, it will be a handle to a remote interface, and it's not clear how to get a reference to local interface from it.

    In short, what is the correct way to use local interfaces with a Stateful bean, if any?

    Thanx in advance,

    Dmitry
  2. I dont understand why you have stateless beans using stateful bean. So guessing your client uses stateless beans to access system. So never guarranteed to have same stateless bean for consectutive method call. But pooled stateless bean is stuck with a stateful bean, so dont understand (if its keeping it as a reference) why this is, you might be loosing some of the scalability of stateless beans.
    If you are using stateful bean as a once off in memory resource or repsoitory, it would seem that all stateless beans would have there own stateful bean , just like as if they held on to a Map, dont see the reason for this.