Can a non-finder method on an EJB return a collection?


EJB programming & troubleshooting: Can a non-finder method on an EJB return a collection?

  1. Hi,
    I'm wondering whether or not it's ok to have an entity or session bean method (that is not a finder, in the case of an entity) return a collection. In general, since the bean is a remote object, the value returned by a method must be serializable; however, I haven't found any specific reference to this issue in the spec. Does anyone know - is there an official policy on this?


  2. why not...since "Collection" is not a return type specified *ONLY* for "find" methods...
  3. The reason you could not find anything specific about this in the spec is that the spec rules are more general: EJBs can return any legal return type for RMI-IIOP. This includes serializable objects. If the implementation of your collection is serializable, there is no problem in returning it.
    Generally the standard collection implementations are all serializable. But it's allways a good idea to make sure.

  4. I think you can find something about it in the articles which talk about RMI