Peter, wait a second. On the client
side
home.findByPersonsName( "Bob" )
should return a Collections of RemoteInterfaces
for all "Bobs".
Sure, your Bean implementation (in case of BMP)
returns the Collections of PK, but the container
intercepts the keys and converts them to RemoteInterfaces.
So it's supposed to be like:
Collection clct = home.findByPersonsName( "Bob" );
for( Iterator itr=clct.iterator(); itr.hasNext; )
{
// This is where YOU USED TO GET a class cast exception...??
Account account = (Account)itr.next();
}
Also, it's a good idea to use PortableRemoteObject.narrow
instead of direct casting.
Best,
Peter Braswell wrote:
>
> All,
> Using JBOSS_2.0_FINAL I'm having difficulty casting
> the results of a ejbFind* to my primary key type
> (AccountPK). I get a 'ClassCastException: $Proxy1'.
> Here's a code snippet:
>
> Collection clct = home.findByPersonsName( "Bob" );
> for( Iterator itr=clct.iterator(); itr.hasNext; )
> {
> // This is where I get a class cast exception...??
> AccountPK pk = (AccountPK) itr.next();
> }
>
> The finder method on the home interface returns a
> Collection, the ejb implementation executes the query
> and builds a vector of AccountPK objects that contain
> the key value return from the query statement.
>
> Am I doing something wrong?
>
> tia,
> peter
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35
> a year! http://personal.mail.yahoo.com/
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> List Help?: [EMAIL PROTECTED]
--
__________________________________________________
Alexander Kogan PTC www.ptc.com
[EMAIL PROTECTED] 140 Kendrick St. Needham MA 02494
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]