Lars Hagrot wrote:
>
> When you build a real system ( not a tutorial) you will recognize the
> problem below.
>
> If you have an Entity Bean and use CMP there must always be a unique
> key. Where does it come from?
>
> 1) from the "user" (and passed as parameter to the create method)?
> 2) from the EJB-Container or some Session bean (how does it know it is
> unique)?
> 3) from the database ( for example "max(col)" or "identity")?
>
> In 1) and 2) you can assign the key in the create method.
> But in 3) you must do a query or insert a row to get the key but how
> can I tell the Container do do that. I am supposed to assign the key in
> the create method.
>
> Is there any standards for this problem?
> Does this imply that example 3) must be implemented as BMP?
If the key contains just an integer field you might be able to rely on your
CMP provider to handle this. I am not saying the spec mandates it, but some
CMP implementations will notice that your key field is null or zero after
ejbCreate, and thereby decide to generate a new key.
________________________________________________________________________________
Evan Ireland Sybase EAServer Engineering [EMAIL PROTECTED]
Wellington, New Zealand +64 4 934-5856
===========================================================================
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".