1

ステートレスEJB3.1(BeanManagedTransaction)で休止状態のセッションを管理すると、Java EE 6環境でセッションがスレッドセーフになりますか?

もしそうなら、各スレッドが並列に実行されるように同時アクセスを管理する方法。

4

1 に答える 1

2

No. I can't imagine how that should work.

The session object is not threadsafe neither the objects returned by the session instance are. For example if two threads use one session instance to select entities, and both select the same database entity, then the one session instance makes the same instance of the entity pojo available to both threads. The concurrent access to this single pojo instance will fail.

Different threads definitively need different Session instances.

于 2012-05-22T15:48:36.003 に答える