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".