Say I have a
servlet which invokes a method on an
EJB (EJBA) via Local interface. This method in turn calls a method on a second EJB (EJBB) via a Remote interface. Assuming the code below, and that Ticket is Serializable, what should the System.outs be?
Heres what I'm seeing:
Point 1: Set by Servlet
Point 2: Set by Local EJB
It looks like foo(...) is pass by value even though its a local ejb, which I think is incorrect. I understand that the call to bar(...) will be a pass by Value, as it is a remote ejb call.
foo2(...) is working as expected.
I'm running on WebSphere 6.0 if that matters.
servlet:
Ticket t = new Ticket();
t.setValue("Set by Servlet");
// ... get Local EJBA reference
ejbALocal.foo(t);
System.out.println("Point 1: " + t.getValue());
ejbALocal.foo2(t);
System.out.println("Point 2: " + t.getValue());
EJBA:
public void foo(Ticket t)
{
// ... get Remote EJBB reference
t = ejbB.bar(t);
}
public void foo2(Ticket t)
{
t.setValue("Set by Local EJB");
}
EJBB:
public Ticket bar(Ticket t)
{
t.setValue("Set by Remote EJB");
return t;
}