[jboss-user] [EJB 3.0 Users] - Returning EJB's from EJB's and transactions

gerbrand do-not-reply at jboss.com
Tue Sep 22 05:55:46 EDT 2009


Hello,

I'm wondering about design of my application. We a lot of EJB (EJB3) using the @Stateless and @EJB tags. All EJB's are now local, but we're considering changing a few in remote interface.

Quite a few EJB's return EJB's also and I wonder if that is correct in the first place, and secondly if this still works (and is correct) if the beans would become remote EJB's:


  | @Stateless
  | @Local
  | class BeanABean implements BeanA
  | {
  | ..
  | }
  | 
  | @Stateless
  | @Local
  | class BeanBBean implements BeanB
  | {
  | @EJB
  | BeanA beanA;
  | 
  | BeanA getBeanA() { return beanA; }
  | }
  | 

Is the above code correct with regard to any JEE spec (I know from experience the code works). Secondly, if I use a BeanA that is returned from by the method of BeanB, is each operation done at BeanA done in a new transaction? Thirdly, what if both BeanA and BeanB become a remote interface (so getBeanA returns a remote interface), is the code still correct?

All of the above might be somewhere in an article, but unfortunately I couldn't find anything that exactly answered my questions.



View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4256340#4256340

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4256340



More information about the jboss-user mailing list