I suppose you are using JPA entity beans. Yes, they can be used as the
data transfer objects(DTO). Entity has state which is a representation
of some data in a database. Entity states are managed by entity manager
in the server. When an entity is sent to a client, it becomes a detached
entity, i.e., it is no more being managed by an entity manager. When the
client sends it back to the server, one has to call merge().
Since transferring entity across remote method boundaries involve Java
serialization, it can be very costly if the entity is related to too
many objects, as the transitive closure gets serialized. That can
contribute to performance degradation. Do you know where the time is
being spent? Is it in the client, or in the server, etc.?
-- Sahoo
glassfish_at_javadesktop.org wrote:
> Hello,
> Don't be angry at me if I'm asking stupid questions:)
>
> I would ask that is it allowed for an EJB to return an entity bean or take an entity bean as a parameter? Or entity beans should be used only on server side?
> For example one of my EJB member returns an entity, and after 2 minutes I send it back to the EJB from my client, is it possible? Or the entity bean has a "special state" or something magic so it shouldn't be sent back?
> I'm asking this because I do the same and when I'm sending back entity beans the whole thing (CORBA) becomes very slow so it's really strange. When I'm sending plain objects, it's ok.
>
> Thanks, MB
> [Message sent by forum member 'mbazs123' (mbazs123)]
>
> http://forums.java.net/jive/thread.jspa?messageID=227392
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>