请问彭老师

您好,我是J2EE新手,问个小问题希望得到您的回答.
问题:在EJB中可以为每个方法设定事务类型,那么是否可以这样认为:一旦方法被设为REQUIRED类型的事务,那么这个方法可以认为被synchronized了,也就是说REQUIRED类型的事务包括synchronized?谢谢!

见到了也不回,好伤心呀!自己顶

c) If a client in transaction context A calls an entity object (the
logical object as seen by him), then the container delegates the call
to an entity bean instance (say, EJB-A). Until the transaction
commits, this instance is only(!) accessible wihtin the transaction
context A.
This means, that another client and/or another transaction context
calling this entity object will not(!) be delegated to EJB-A, but to
another entity bean instance EJB-B. EJB-A and EJB-B represent the same
logical entity object and both can be understood as being in-memory
copies (caches) of the same database


这段话的意思是不是说:一条数据库记录在内存中可能有两个缓寸数据?请指教,谢谢!


在我的J2EE实战教材中,我指出了支持实体bean底层实际是Cache+Pool的机制。

一个数据库记录在内存有Cache和pool,因此随着并发访问量可能有很多个。

那么对于SESSIONBEAN来说是不是也是CACHE+POOL的机制?

无态SESSIONBEAN是Pool
有态SESSIONBEAN是Cache

呵呵,你耐心真好,谢谢了!
我了解过有态SESSIONBEAN不能被并发的访问,对此我有疑问;我要是把它的全部方法都设成REQUIRED事务,那么是不是可以认为这些方法都被synchronized了,这时候如果有多个请求的话,应该不会出问题吧!

>无态SESSIONBEAN是Pool
>有态SESSIONBEAN是Cache

个人认为是
Stateless Session Bean是Single instance
Stateful Session Bean是Pool
Enity Bean是Cache + Pool

我不认为这样,有态Bean可以专门设定Session Synchronized

>我不认为这样,有态Bean可以专门设定Session Synchronized
小弟才疏学浅
不知道什么叫做Session Synchronized
可不可烦请说详细一点
谢谢

彭老师:我的问题您还没有回答呀!

>f起砗芏啵刹殚有P文章,下面是一篇:
>http://www.onjava.com/pub/a/onjava/2001/10/02/ejb.html
谢谢提供
我看了了解session synchronized是指使用SessionSynchronization interface
但是这跟有没有用cache有什么直接关系嘛?
Thanks in advance

我贴的帖,你们两个在那里讨论自己的,无视我的存在,严重抗议啊!!再顶!!请求解答,谢谢!!