无状态会话 bean 中的实例变量
我已阅读这篇文章,但它没有回答我的问题。 带有实例变量的无状态会话 bean 我正在阅读 JEE5 教程,在此页面上它指出 http://download.oracle.com/javaee/5/tutorial/ doc/bnbly.html ” 但是,客户端可以更改池化无状态 Bean 中实例变量的状态,并且此状态将保留到池化无状态 Bean 的下一次调用 “
我不同意这一点..因为我认为在不同的 Bean 实例的调用中保持“任何”类型的状态是需要“有状态”会话 Bean 的功能。
请帮助我理解这一点 提前谢谢 鲁班
I have read this post and it doesn't answer my question.
Stateless session bean with instance variables
I am reading the JEE5 tutorial and on this page it states
http://download.oracle.com/javaee/5/tutorial/doc/bnbly.html
"
Clients may, however, change the state of instance variables in pooled stateless beans, and this state is held over to the next invocation of the pooled stateless bean
"
I don't agree with this.. coz i thought keeping 'any' kind of state across invocations of different instance of beans was something you need 'stateful' session beans for.
Please help me understand this
thx in advance
Rooban
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 EJB 中,“有状态”和“无状态”之间的区别指的是会话状态,而不仅仅是 Java 对象状态(即实例字段的任何使用)。
来自维基百科:
典型的例子是电子商务应用程序的购物车。您可以使用 SFSB 来存储“购物车”对象,因为它需要维护请求之间的会话状态。
另一方面:
相关问题
In EJB the distinction between "stateful" and "stateless" refers to conversational state, not simply Java object state (that is, any use of instance fields).
From Wikipedia:
The classic example is that of a shopping cart for an ecommerce application. You'd use a SFSB to store the "cart" object because it needs to maintain conversational state between requests.
On the other hand:
Related questions