Thanks, thats exactly it.

Permjeet

-----Original Message-----
From: Frank LaRosa [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 04, 2001 6:55 AM
To: Orion-Interest
Subject: Re: Returning Collections from ejbFindXXX()


The reason you're getting an exception is because the collection of Strings
you return from your EJB method is not the same collection that the client
receives. The client receives a collection of your EJB's remote interface
class, and that is the class to which you should cast the results.

Remember that it is the EJB container (Orion) which calls your EJB methods,
not the client. Orion receives your String collection and uses it to create
a collection of EJBs which are returned to the client code.


----- Original Message -----
From: "Permjeet Pandha" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Tuesday, April 03, 2001 8:53 AM
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
>
>
>


Reply via email to