conversational state of session beans

后端 未结 3 1041
天涯浪人
天涯浪人 2021-01-05 03:23

I\'m reading a book on Java EE 6 and I met with the following parts:

\"Stateless: The session bean contains no conversational state between methods, and any ins

3条回答
  •  一整个雨季
    2021-01-05 03:44

    Regarding the second part of the question, from the java EE 6 tutorial you can read the following:

    When toUse Session Beans

    Stateful session beans are appropriate if any of the following conditions are true.

    • The bean’s state represents the interaction between the bean and a specific client.
    • The bean needs to hold information about the client across method invocations.
    • The bean mediates between the client and the other components of the application, presenting a simplified view to the client.
    • Behind the scenes, the bean manages the work flow of several enterprise beans.

    To improve performance, you might choose a stateless session bean if it has any of these traits.

    • The bean’s state has no data for a specific client.
    • In a single method invocation, the bean performs a generic task for all clients. For example, you might use a stateless session bean to send an email that confirms an online order.
    • The bean implements a web service.

    Java EE 6 Tutorial

提交回复
热议问题