Originally posted by mini mehta:
HFE(Head First EJB) some where says that the return type should RMI-IIOP and also says that the collection itself should be serializable in addition to the elements of the collection.
I think the above posts are correct.
You are also right, if you examine just the Collection interface alone. That does not implement Serializable interface. But what HF EJB means is that at run time the Collection interface should denote an object that implements the Serializable interface. for example: ArrayList, Vector, LinkedList etc...
So it's words phrasing issue!...
. I am sure non-english speaking candidates would also find this a bit confusing at first!....
You could write your own custom list or linkedlist implementing the Collection interface but not Serializable interface. Such Object(s) are not allowed as the return types for remote methods.
So when writing code for bean methods returning a Collection interface,
for example: Session bean methods returning a Collection, we should make sure that we select a Collection class that implements Serializable like ArrayList, Vector etc......