3 Replies Latest reply on Apr 16, 2009 7:13 AM by jaikiran

    EJB 3.0 with Stateless Session Bean as instance variable

    wichkabashir

      Example.
      @MessageDrivenBean
      public class CalculatorMDB {
      @EJB Calculator cal;
      onMessage()
      {
      ...
      }

      }

      I have injected a stateless session bean instance in MDB and that there are 5 mdbs in the pool but every time mdb receives a message different instance of stateless session bean is created. Is there way to make one to one instance mapping so that every invocation of mdb doesn,t create a new session bean instance. It seems mdb resets it's instance variables and creates new instance variable for every message it gets from jms topic.

      Suggestions appreciated.
      Ahmed