Collection returned by finder methods are serialized to the clients or referenced?
When a client access a EJB and invoke each finder method, the result back to the client is a collection (for every finder methods unless the findByPrimaryKey). This collection is serialized to the client o is accessed by the client from the container remotely?
Collection sent back to the client is serialized.
Each element in the collection will be a remote handle. And invoking a method on any of these handles will result in a remote call.
Thanks very much!!!
This mean it's very inefficient if the returned collection is a very large Collection. Even although the collection just contains references to objects....
So I understand return a collection back to client is a bad design!!!
accessing a entity bean directly from a client is also a very bad design!
i suggest to use a (stateless) session bean which calls the finder of the entity bean and gets the collection, and transform it here, in the session bean, to a collection of primary keys or value objects and return that to the client.
(you can use the same method when you pass an additional parameter for the nedded class and check against it in the transform phase ;-)
what do you think about this?!
Well, I think a better goal is to keep Entity beans in the container and a SessionBean return back to the client a slot (a range) of serialized copies of Entity beans, let say, serialized instances of class <EntityBeanName>Info with the set's and get's methods for every property.
Serializable is implemented by this <EntityBeanName>Info class...
Is it Ok?