EJB design: ArrayList x Collection between EJB tiers

  1. ArrayList x Collection between EJB tiers (1 messages)

    I've seen a lot stuff like this:

    An entity ejb returns a java.util.Collection to a session façade, and the session façade adds this collection to an java.util.ArrayList.

    What's really the big deal on letting the client perform operations on Collections?

  2. The Collection returned by the Entity may be a proprietary Collection subclass available only on the server. Therefore, it may not be possible to serialize that Collection and send it to the client.

    By having the Session Facade transfer data into a java.util.ArrayList, you ensure that the Collection is a standard Java collection, and therefore ensure that it will serialize and deserialize correctly.