0 Replies Latest reply on Nov 2, 2010 12:35 PM by Iván Pazmiño

    Stateless EJB lifecycle

    Iván Pazmiño Novice

      I have a stateless ejb3 component that's serving to business methods an  insert to the database and a query to the data base. In a @postconstruct  method I get a connection from an injected datasource, and, in a  @predestroy method i close the connection and null the datasource  reference.

      In a client I get a reference to the stateless component injected. Then,  in different times, I call one of the method business and then the  other. Always the that is called first performs its task and finishes  successfully. But the second method fails complaining the connection is  not associated with a managed connection.

      Shouldn't the connection be alive as long as the slsb has not been destroyed?