Hi,
What you explain, is not strange, it is simply the behaviour Java uses
when passing parameters. (If you like it or not, that is another
question!
Parameters in Java are not "inout parameters". The reference (=pointer)
to an object is copied when passed to a method.
You can use a return parameter:
public Order processOrder()
{
Customer c = null;
if (orderType.equals("typeA")
{
c=processA(c, orderManager);
}
else if (orderType.equals("typeB")
{
c=processB(c, orderManager);
}
logger.log("customer is "+c);
//this prints null. though i populate it in process methods.
}
private Customer processB(Customer c, OrderManager orderMgr)
{
-- some lines --
c = CustomerBean.getCustomerByID(orderMgr.getCustomerI d());
//this is a session Bean.
logger.log("customer in process method = "+c); //prints fine
return c;
}
Ciao,
Ingo