OK, that sounds like what I was proposing. I'm not too worried about the buyer or seller finding the other's info (this is just a simulation, if some MBA student really wants to hack it, well, they can). Rather, I was just concerned about breaking OO principles by having a lookup to grab an object--this object may be used by other people, at other times.
By having this class that can return an account object to anyone who requests it, concepts such as abstraction layers and low coupling can be ruined. Lazy programers (not me, of course, I'm never lazy :-p ), don't have to owrry about passing objects around to get them to the classes who need them, then can just request them directly. You effectively turn these classes into "global variables."
I have used this techinque in J2SE projects. Sometimes it does make sense to have such a public repository. While there are no programmatic constraints on data access (everything is public), the system architect tells everyone to follow a certain design principle that these clasees may onyl be accessed under certain circumstances in certain ways, and he carries a big rubber hose to enforce those principles :-)
In
J2EE, is it ok to do the same thing, or is there a better way to create such a repository? (Again, security isn't a major concern, but good OO design is.)
--Mark