O'Reilly logo

Head First EJB by Bert Bates, Kathy Sierra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The five standard application exceptions from the client’s point of view

Two of the five are more specific—DuplicateKeyException and ObjectNotFoundException. If the client gets an ObjectNotFoundException, the client has more information than if he gets a more abstract FinderException. And if the client gets a DuplicateKeyException, he knows a lot more about what went wrong than if he gets a generic CreateException.

CreateException

The client does not know for certain whether the bean was actually created. The Container might have had a problem after the transaction committed.

image with no caption

DuplicateKeyException

If the client catches a DuplicateKeyException, she can be 100% certain that the bean was not created.

image with no caption

FinderException

The client does not know whether a matching entity (or entities, for multiple-entity finders) exists in the database. The Container might throw a FinderException because of something that went wrong before it was able to look in the datbase.

image with no caption

ObjectNotFoundException

If the client catches an ObjectNotFoundException, she can be 100% certain that there was no match for this primary key in the database. Remember, ObjectNotFoundException is for single-entity finders only, so a client will ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required