[EMAIL PROTECTED] writes:
> 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.
Yes, I am cognizant with this. The question was regarding the client
view of the bean, and why the container didn't return what his bean
returned.
> 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.
Yes.
> 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.
I hadn't picked that.
Tom
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]