JBoss Community

Stateless EJB lifecycle

created by Ivan Pazmino in EJB3 - View the full discussion

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?

Reply to this message by going to Community

Start a new discussion in EJB3 at Community