In section 9.1.9.1 of the EJB1.1 spec describing CreateException thrown from a
Home create method, it says "If a client receives
this exception, the client does not know, in general, whether the entity object
was created but not fully
initialized, or not created at all. Also, the client also does not know whether
or not the transaction has
been marked for rollback.".
IMHO this is not a good contract from a client point of view, because the client
has no means to determine whether the entity was created or not, or to attempt
any fixup of a partially initialized object (since they got an exception instead
of a returned entity reference), and therefore no option other than rollback to
make sure that they don't persist an improperly or incompletely initialized
entity.  Or am I overlooking something about the current contract?

Here are some different contracts that I think would be better than the existing
one for the CMP/BMP provider's responsibility when control returns to a client
with a CreateException from a Home create method, because they would relieve the
client of responsibility for cleaning up an incompletely initialized entity:
1. Require that the entity must not exist, but not mark the transaction for
rollback. This is the simplest for the client programmer, but makes the CMP/BMP
provider's job harder by removing the flexibility to mark the transaction for
rollback.
2. Require that either the entity does not exist or that the transaction has
been marked for rollback. This allows much flexibility for CMP/BMP provider,
making it simple for CMP/BMP provider to implement. Although it does relieve the
client programmer for responsibility to clean up an incompletely initialized
entity, it still forces the client programmer to design for transaction
potentially (but not necessarily) being marked for rollback.
3. Require that the transaction has been marked for rollback. This would be
simple for CMP/BMP provider to implement, and is a clear and simple contract for
the client programmer.

Erik Voldal
Email: [EMAIL PROTECTED]
Phone: 507-253-4788

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