You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Shawn Jiang <ge...@gmail.com> on 2011/05/19 17:51:32 UTC

Default session type of session bean is "SessionType.STATELESS" when no session type assigned in DD.

public class SessionBean implements RemoteBean, Session, TimerConsumer {

.....
sessionType = SessionType.STATELESS;
....

}

This will lead to problems when users write a @stateful session bean BeanA
and also define it in DD without a session type.

    <enterprise-beans>
        <session>
            <ejb-name>BeanA</ejb-name>
        </session>
    </enterprise-beans>


at the same time ,  there are code logic based on the sessionType of
sessionBean.    Bean A will not be picked up in following logic because its
session type is STATELESS.

org.apache.openejb.config.LegacyProcessor.process(Class<?>, EnterpriseBean)
{

.....

if (sessionBean.getSessionType() == STATEFUL &&
SessionSynchronization.class.isAssignableFrom(clazz)) {
                try {


....

}


My initial thoughts is to

1, remove the default session type.
2, assign the session type in
org.apache.openejb.config.AnnotationDeployer.DiscoverAnnotatedBeans.deploy(EjbModule)
before calling any logic that depends on session type.

But I'd like to know the background of the default SessionType.STATELESS
value.


-- 
Shawn