EJB3 Transaction Propagation

后端 未结 8 1695
隐瞒了意图╮
隐瞒了意图╮ 2020-12-13 04:25

I have a stateless bean something like:

@Stateless
public class MyStatelessBean implements MyStatelessLocal, MyStatelessRemote {
    @PersistenceContext(unit         


        
8条回答
  •  天涯浪人
    2020-12-13 05:04

    I haven't tried it yet (I'm about to), but an alternative to injecting a self-reference via the @EJB annotation is the SessionContext.getBusinessObject() method. This would be another way to avoid the possibility of a circular reference blowing things up on you - although at least for stateless beans injection does seem to work.

    I'm working on a large system in which both techniques are employed (presumably by different developers), but I'm not sure which is the "correct" way to do it.

提交回复
热议问题