geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Carew" <>
Subject Re: Looking up the datasource in a session bean constructor
Date Wed, 05 Apr 2006 13:18:08 GMT
Your code shows that the datasource is being assigned to a local variable in
the constructor. It needs to be stored in an instance variable because the
EJB container won't necessarily create a new instance of the session bean
whenever ejbCreate is called (it can pool instances and reuse them). Also I
would recommend doing the lookup in the  setSessionContext method. I think
the spec requires the container to make JNDI lookups and other server
services available  in setSessionContext method, not sure if it requires
those services to be available in the constructor.

View raw message