Shiv Kumar wrote:
> 1. What is a good example of 'dependant object'? The spec gives an
> example of employee record. It says an employee record should be
> modelled as entity beans, but employee address and phone number
> should not be.
Yes; a particularly bad example for all but the simplest applications.
Their point is that something that is *wholly owned* by a containing
object (i.e. something that goes away when its owning object goes away)
is a dependent object. When put this way, it is quite obvious that
making such an object an entity bean is moderately pointless.
> * What if all employee addresses are maintained in a different
> table in the db?
Well, where things are persisted has nothing to do (he said, lying
somewhat) with whether something is an entity bean or not. I know where
you're going here--you're going to say something about how Weblogic's
(how did I guess) asinine CMP engine doesn't let you do anything other
than primitive-field-to-single-database-table, and so therefore your
design is necessarily limited.
Not so. Use Cocobase instead. (http://www.thoughtinc.com)
> * And phone number of course will be a field in my EB. Why should I
> ever model it as a dependant object?
Suppose you have a telephone number object like this:
public class TelephoneNumber {
private String countryCode;
private String areaCode;
private String prefix;
// etc., with getters/setters
}
...and you know that a person will wholly own his telephone number and
won't share it with others, and you know that when the person is deleted
his phone number will be too. Then this telephone number object, which
you might create to make accessing the bits of the number easier, is a
dependent object.
> I think, dependant objects are only useful when used with SBs.
Nope.
Cheers,
Laird
===========================================================================
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".