May Charles N wrote:
>
> All right, I've got this CMP pattern which keeps recurring. If this is
> common say so, but I haven't seen others' solutions to it. I've got a few
> proposed solutions and would like feedback. I'm working in VisualAge for
> Java 3.5.2.
>
> Beware before you send suggestions -- using BMP is NOT an option here. I
> need a CMP solution.
>
> The problem occurs when there are two CMP entity beans in a 1-many
> relationship and a CMP attribute in one bean is dependent on the other
> bean's attribute(s) or number of instances. For example (this is ONLY an
> example to illustrate the concept by analogy), Employer and Employee are in
> a 1-many relationship, and Employer has persistent attributes numEmployees
> and totalEmployeeSalaries.

>   <snip>

This is really a database problem rather than and EJB-specific problem. There is
no universal solution to the summary record problem and the right design usually
comes out of careful consideration of the usecases and other external aspects of
the application to answer such questions as:

1. which are the most frequent operations - use of the summary
   record, or changes to the detail records.
2. how many  records are being "summarised"
3. whether or not it really is essential that the summary
   be accurate (if so you had better lock all records while using the summary
   to prevent changes - probably not really what you want to be doing)
4. How important database portability is.



Ian McCallion
Alexis Systems Limited
Romsey, UK

===========================================================================
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