Pet Store Model Manager Question

One thing escapes me in the Pet Store application:

The ModelManager object contains the HttpSession

variable,

public class ModelManager extends ModelUpdateNotifier implements java.io.Serializable {

private ServletContext context;

private HttpSession session;

private ShoppingClientController sccEjb = null;

....

}

and retrieves some data from session, e.g.

public CustomerWebImpl getCustomerWebImpl() {

CustomerWebImpl customer = (CustomerWebImpl)

session.getAttribute(WebKeys.CustomerWebImplKey);

if (customer == null) {

customer = new CustomerWebImpl(this);

session.setAttribute(WebKeys.CustomerWebImplKey, customer);

}

return customer;

}

But then how is ModelManager stored in the session

variable itself?

ModelManager modelManager = (ModelManager)

session.getAttribute(WebKeys.ModelManagerKey);

Isn't this recursive? Can someone please shed some

light on this? Thanks.

[1033 byte] By [chemali] at [2007-9-26 4:48:40]
# 1
<< Isn't this recursive? Yes, if you want to call it that.However, what is your concern about it being that way ?
neville_sequeira at 2007-6-29 18:39:04 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

Depending on implementation, the concern is that a

huge amount of space can be wasted if the model

manager is saved into the session variable and vice

versa: the session variable contains model manager,

which contains session variable. How is the session variable saved? Is it saved once, or more (since it

is in model manager)?

chemali at 2007-6-29 18:39:04 > top of Java-index,Other Topics,Patterns & OO Design...