You may want to take a look at the new J2EE patterns hosted at Sun's Java Developer Connection: http://developer.java.sun.com/developer/restricted/patterns/J2EEPatternsAtAG lance.html You'll need to login to view it, but there are some relevant patterns with regard to your question (especially look at the Value Object Assembler and Aggregate Entity). Hope this helps. -- chris -- -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Alex Paransky Sent: Sunday, March 11, 2001 3:56 AM To: Orion-Interest Subject: EJB encapsulation (data hiding) pattern... Is there such a thing? I am trying to model a Person having many Phones with two Entity beans. Person and Phone are both entity beans. But I do not want to allow anyone to manipulate the Phone directly. I only want Person to be able to: Person.addPhone(PhoneValue) Person.removePhone(PhoneKey) Person.updatePhone(PhoneKey, PhoneValue) Person.getPhones(). In other words, Phone is treated like a dependent (except on advice of others, I have stopped using dependent objects). Is there a way I can enforce this? In other words, how can I stop any one except Person, from using the PhoneHome/PhoneBean directly? The reason I need to do this, is because Person performs additional logic when phones are added or removed or changed. This logic, must always be performed, so I do not want someone to use the PhoneHome to find the Phone and change it without the person knowing. -AP_ www: http://www.standardset.com resume: http://www.standardset.com/resume_body.jsp home: (818) 541-0029
