On Nov 15, Tom Cook quoth:
> Erm... fools rush in where angels fear to tread and all... but doesn't
> findByXXX return a collection of remote interfaces? Not a collection
> of primary keys? Someone tell me I'm right here, please?
"You're right"... (mostly) :-)
> Section 8.3.2:
>
> "The return type of a finder method must be the entity bean's remote
> interface, or a type representing a collection of objects that
> implement the entity bean's remote interface (see Subsection 9.1.8)."
My understanding is that the finder method in the bean returns a
collection of _PK_ types to the container and the container returns to the
client a collection of (objects implementing the) remote interface.
Section 8 is the client view of the bean. Section 9 provides the other
half (and a more complete) explanation of the relationship between the
Bean and the Home interface findXXX() methods.
SS 9.1.8.2
Some finder methods are designed to return multiple entity objects.
For these multi-object finders, the result type of the
find<METHOD>(...) method defined in the entity bean's home interface
is a collection of objects implementing the entity bean's remote
interface. The result type of the corresponding ejbFind<METHOD>(...)
implementation method defined in the entity bean's implementation
class is a collection of objects of the entity bean's primary key
type.
Therefore the client should expect a Collection (or Enumeration) of remote
interfaces, the implementation in the bean class should return a
Collection (or Enumeration) of the Primary Key class.
C=)
P.S. Readability tip: I want to also point out that the EJB spec only
defines findXXX(), not findByXXX() as the prototype for how a finder name
is constructed. Useful when findByFoo() is less readable than findFoo()
in your application.
--------------------------------------------------------------------------
If you want to build a ship, don't drum up people together to collect wood
and don't assign them tasks and work, but rather teach them to long for
the endless immensity of the sea. -- Antoine de Saint Exupery
--------------------------------------------------------------------------
Caskey <caskey*technocage.com> /// TechnoCage Inc.
--------------------------------------------------------------------------
It's not an optical illusion, it just looks like one. -- Phil White
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]