[EMAIL PROTECTED] wrote:

> Hi
> I have read back and forth about DON'T reference entity beans from another
> entity beans, as well as the opposite. I have failed to get  a good logical
> reason why this is bad and obviously is entities referencing each other
> convenient from time to time.
>
> For example: I want to use CMP beacause it's fast to develop and the
> database is very simple. A person has a bunch of phone numbers. If I design
> the person entity bean to have a bunch phone number entities in a vector.
> (The vector IS NOT a CM field). Otherwise I need a session bean (or the
> client, god forbid) to be a proxy for these two entity beans to have some
> useful object to work with.
> Of two bad things, I think the first one is the best.
>
> Are there some transaction, DB-locking issues I haven't thought about here?
>
> I am not asking about fine or coarse grained component design here. I'm
> programming to provide a good money/quality ratio for my customers.
> Therefore a pragmatic answer to this would be very appreciated.

I may be misinterpreting your question because this does appear to be an issue
of fine grained versus
coarse grained component design.  Why would you store the phone number as an
entity bean and
not just a regular business object?   Then you could just use a vector of
PhoneNumber objects in the
Person object.

For example

public class Person implements EntityBean {

private Vector myPhoneNumbers;

...

public void ejbLoad() {
// loads myPhoneNumbers from the db

..
}

public void ejbStore(){
//Stores the vector of phone numbers to the db
}
}

public class PhoneNumber {  //Not an entity bean
  private String myNumber;
  public String getNumber(){ return myNumber;}
}


>
>
> Regards
> Erik Romson
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to