> From: A mailing list for Enterprise JavaBeans development
> [mailto:[EMAIL PROTECTED]]On Behalf Of Richard Monson-Haefel
> This is interesting. You believe that the bean developer must
> manually set the relationships and I believe that they must be set
automatically by the
> container. Why would the specification define these relationships in the
> abstract persistence schema if you have to set them up
> "manually"? It doesn't make sense. The container should automatically
apply the other end of the
> relationship when its bi-directional. For example, setting the
> SalesRep on Customer should automatically add the Customer to the
SalesRep's customers
> relationship field. How do others interpret this?
Correct: [10.4.2.2] and [10.3.6].
Several gotchas to keep in mind:
- If a field is both a CMP and CMR, you can't call its setter (this will be
done automatically by the container as soon as it is possible to do so, i.e.
when the object has an identity)
- Objects in a collection are transfered to and from their collections,
*but* the identity of the Collection in the respective participants is
unchanged
- In reference to your previous question: adding an object to a collection
CMR field and then testing right away if it is part of the collection is a
vendor-dependent behavior and also subject to several factors (such as the
transaction boundary, the commit option, etc...). For example, suppose that
the container doesn't implement any caching and that each get of a CMP/CMR
field causes a query to be issued to the database. With such a container,
the transaction will need to be committed before you can see your object
materialize in the collection
--
Cedric
===========================================================================
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".