FinderException not thrown

Discussions

EJB programming & troubleshooting: FinderException not thrown

  1. FinderException not thrown (1 messages)

    I am developing a CMP EJB which defines acustom finder to locate beans with a particular condition. This condition would retrieve a collection of beans based in the parameter sent.

    I was expecting to receive an Exception whwnever the condition will not retrieve any bean from the DB. I have seen this behaviour when calling a finder method which will retreive a single bean (like the findByPrimaryKey), but my custom finder will retrieve a collection of beans. Problem is that it is not raising the FinderException, is this the normal behaviour? How could I tell that the finder method did not retreive any data?
  2. FinderException not thrown[ Go to top ]

    Hi,

    Yes this is correct behavour. The spec says for Finders that return Collections the EJB container should return an empty collection rather than throwing an ObjectNotFoundException.

    David