Multiple choice technology programming languages

A client calls a finder method whose return type is a Collection of references to the remote interface of an entity bean. Assume no match for that entity is found. Which of the following will be the result of this call?

  1. ObjectNotFoundException.

  2. An empty Collection will be returned.

  3. An entity would be created and a reference to that entity would be returned.

  4. EntityNotFoundException.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

According to the EJB specification, finder methods returning a Collection must return an empty collection if no matching entities are found. ObjectNotFoundException is only thrown for single-object finder methods (like findByPrimaryKey) when a match is missing, while automatic entity creation never occurs on a failed lookup.