I assume that both beans are entity beans.
I do not think that garbage collection is god idea for entity beans.
There a lot entities that are useful even if they are not referenced.
Recorded measurements may be example of such entity.
We are explicitly checking if bean is referenced an forbid to delete it
if it is referenced. We have done it in generated from UML part of
bussiness
logic layer. When bean is referenced then it is notified about it. When
it is
unreferenced it is also notified about it. Entities that participiated
in
aggregation relationship with parent entity are automatically removed at
remove operation of parent enity. It is very tedious an errorprone if
relationship code is not generated.
Constantine
Jon Tirsen wrote:
>
> In our implementation of CMP the "container" (which in this case is a
> generated BMP-bean from a CMP-bean) throws an exception. This should not
> happen and is some kind of constraint-violation. The problem one is
> encountering is that EJB uses explicit lifespan-control and not implicit
> (ie. garbage collection). Actually the exception should be thrown at an
> earlier stage. A referenced entity should not be able to get deleted. So
> either the remove-method should throw an exception or the transaction should
> not be able to commit. (If the an earlier commited transaction referenced
> the entity which this one referenced.)
> In my domain and experience, administrational systems, this almost never
> happens. Beacause one selldom deletes things, they should be saved for
> statistics.
> Maybe the CMP facility should implement some kind of "garbage collection",
> or at least referential integrity checking. (Problem is when a CMP-bean
> references a BMP-bean, but that's another story.)
>
> > -----Original Message-----
> > From: A mailing list for Enterprise JavaBeans development
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Rickard �berg
> > Sent: den 30 maj 1999 12:49
> > To: [EMAIL PROTECTED]
> > Subject: Referential integrity
> >
> >
> > On EJB1.1 CMP.
> >
> > If a Entity bean uses CMP and references another bean, the CMP
> > implementation might support saving the reference in the database. What
> > should happen if the bean is passivated and when it is later activated
> > the referenced bean is no longer available?
> >
> > Should the container:
> > a) set the reference to null
> > b) throw some exception (i.e. the bean instance can never be loaded
> > again, unless the referenced object is recreated /w same pk)
> >
> > /Rickard
> >
> > --
> > Rickard �berg
> >
> > @home: +46 13 177937
> > Email: [EMAIL PROTECTED]
> > Homepage: http://www-und.ida.liu.se/~ricob684
> >
> > ==================================================================
> > =========
> > 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".
===========================================================================
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".