What is better Singleton or SLSB ?


EJB design: What is better Singleton or SLSB ?

  1. What is better Singleton or SLSB ? (3 messages)

    For a Process oriented JavaBean what is a better implementation make it a Singleton or implement it using stateless session bean.
  2. What is better Singleton or SLSB ?[ Go to top ]

    I think it basically boils down to whether you want the features ejbs (or the container) provides. If you are want to call this process remotely or use security or transaction management then may be stateless session bean would be helpful.
  3. As replied earlier, its the need that drives the decision. Why at all use a bean if u give a damn to transaction, auto persistence mgmt, instance management etc etc , basically all the services that conatiner provides.
    If its simply a method call for which u dont require such expensive conatiner managed feature u can well use a singleton approach.
    As such creating and managing beans is an resource expensive feature and prudence must be excercised when using them.

  4. session+singleton[ Go to top ]

    combination of both are used in our case, session bean and singletons at DAO layer. I agree with others too