>>     public Integer ejbCreateUniqueLocal(String name, String
>> firstName, Character article)
>>         throws CreateException {
>>
>>       ArtistLocalHome home = (ArtistLocalHome) ctx.getEJBLocalHome();
>>
>>       try {
>>         home.findByNames(name, firstName, article);
>>       } catch (ObjectNotFoundException o) {
>>         // good, we did not find it
>>         return ejbCreate(name, firstName, article);
>
>Here, don't you intend this line directly above to be:
>          return home.create(name, firstName, article);

I don't know. Is that the proper way? I'll have to check whether that has
an effect
to my deadlock problem but I doubt it.


>       } catch (FinderException f) {
>         throw new CreateException("f");
>       }

Janne, Could you explain why you catch a FinderException?

And what's the rationale for this code?
>
>       // we found it - error!
>
>       throw new DuplicateKeyException
>       ("artist already exists");
>     }

There's two create -methods, createUniqueLocal() and create(). Create just
creates a new entity without checking whether one with same name,
firstName,
article already exists. This causes a database error when it happens.
CreateUniqueLocal just checks first whether identical entity exists by
calling
home.findByNames(). If ObjectNotFoundException is thrown, everything is OK
(a bit messy? yes...), and if ObjectNotFoundException is not thrown, we
throw DuplicateKeyException.

FinderException is catched because create method does not throw those, and
CreateException thrown instead.

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