On Thu, 09 Dec 1999, Tom Jordan wrote:
>
> I was hoping i could get some suggestions from people on how to best handle
> the issue of persisting data. For discussion purposes, lets use Order and
> Order line items. I have modeled Order as a CMP based entity bean. From
> previous posts in the archives I gather that dependant data should not be
> modeled as entity beans. In which what is the suggested design for
> persisting and loading the line items.
Yes, that's the general gist of the list. Dependent objects should not be
modeled as entity beans. The way I see your situation, then, you've got a few
choices:
1) Simply have your OrderLineItems have a foreign key to your Order beans. The
standard way to do one-to-many relationships. But that requires your
OrderLineItems to be entity beans.
1) Make your Order bean use bean-managed persistence and write SQL to control
the dependent objects. Sounds like this is what you've been doing.
2) Use an object/relational mapping tool to map Orders to OrderLineItems and
thus avoid handwriting SQL.
For one-to-many relationships like this, I don't think there are too many
alternatives. Personally, I would just make OrderLineItems into entity beans
because I want to avoid handwriting SQL and I don't want to use an O/R tool. I
would make sure the transaction properties for OrderLineItem are such that they
don't force a new transaction to be started on their own.
regards,
david
--
David Sims [EMAIL PROTECTED]
Sims Computing, Inc. www.simscomputing.com
===========================================================================
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".