0

I'm using JBoss 7.1.1 and I have to pass an argument between two session beans. Is it possible to pass arguments by reference from a local stateful session bean to a local stateless one?

Thanks!

Maverik
  • 179
  • 1
  • 1
  • 9

1 Answers1

1

That's how it works between local client and local client view. It is not only possible, but it is the way how it's specified to work. I do not try to rephrase in details, because this is quite nicely written in EJB 3.1 specification:

Session beans may have local clients. A local client is a client that is collocated in the same JVM with the session bean that provides the local client view and which may be tightly coupled to the bean. A local client of a session bean may be another enterprise bean or a web component.
...
The arguments and results of the methods of the local client view are passed “by reference”[1]. Enterprise beans that provide a local client view should therefore be coded to assume that the state of any Java object that is passed as an argument or result is potentially shared by caller and callee.

[1] More literally, references are passed by value in the JVM: an argument variable of primitive type holds a value of that primitive type; an argument variable of a reference type hold a reference to the object.

Mikko Maunu
  • 41,366
  • 10
  • 132
  • 135