When you return something in a Collection ejbFindByXXX method, what you
return is the KEY of your table (in your case I think the key is a
String...). What you get in the home interface is a collection of remote
references of your ejb-object (for example Customer object in a CustomerBean
ejb...).
----- Original Message -----
From: "Permjeet Pandha" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Tuesday, April 03, 2001 3:53 PM
Subject: Returning Collections from ejbFindXXX()
> Hi,
>
> Has anyone tried to return Collections from a BMP ejbFindAll() type of
> operation?
>
> I return an ArrayList of String objects, the client receives this list ok
> but gets a cast exception on trying to extract the String from the list.
eg.
>
> public Collection ejbFindAll() throws java.rmi.RemoteException,
> javax.ejb.FinderException
> {
> ArrayList v = new ArrayList();
> v.add("First");
> v.add("Second");
> return v;
> }
>
> and the client code:
>
> Collection coll = home.findAll();
> System.out.println(coll.size() + coll.toString()); // this shows
> correct count and contents: "2[First, Second]"
> Iterator iterator = coll.iterator();
> while(iterator.hasNext())
> {
> String s = (String)iterator.next(); // class cast exception
> System.out.println("Desc=" + s);
> }
>
> On closer inspection with a debugger it turns out the objects in the list
> are of class __Proxy5, some sort of orion proxy object.
>
> This appears to be a bug but I'd like to be sure in case its me. Has
anyone
> done this successfully?
>
> I'm using orion 1.4.5, I cannot seem to upgrade with autoupdate due to
> (probably) firewall restrictions.
>
> TIA
>
> Permjeet
>
>