EJB programming & troubleshooting: Should i mark the session context as transient?

  1. Should i mark the session context as transient? (1 messages)

    When i create a new stateless session bean i usually kick it off with some copied-and-pasted code that looks like this:

    public class SomeBean implements SessionBean
    private SessionContext mySessionCtx;
    public void setSessionContext( SessionContext ctx )
             mySessionCtx = ctx;
          //... etc

    However, i've only just noticed that my bean implements Serializable due to inheritance via the SessionBean interface, and i noticed that the SessionContext interface is not serializable.

    So should i be marking mySessionCtx as transient?

    Threaded Messages (1)

  2. No[ Go to top ]

    No because the bean is serializable so the container can do passivation, however the container will take care of passivating "J2EE" objects such as DataSource, context etc.