• Post Reply Bookmark Topic Watch Topic
  • New Topic

Returning Entity with Session  RSS feed

 
Luciano A. Pozzo
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I return an Entity on a Session, the Entity object is entire passed through the network for my Desktop Client or just a reference?
Because if is a reference, the traffic on network will cause problems.

Ex:
This is a session bean stateless method, and the Client is an entity:

public Cliente search(int id)
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Luciano,

The container will return you back a list of remote interfaces. However this might not be the best practice though. Since EJB2.0 local interfaces are preferred with entity ejbs and the entity layer should be completely abstracted from the clients. It would be better if your search method will return a list of DTOs (check the DTO and DTOFactory design patterns). Your SLSB in turn will access only local entity beans and will map them to a set of domain or custom data objects.
As for the network traffic though, this is another issue and you should probably do some capacity planning in order to implement your application. As a matter of fact lots of projects learned to leave with similar problems. Ultimately you have to understand that if your business requirements demand that large sets of data need to be returned to the clients, then entity beans are probably not the right solution for you anyway (straight jdbc code might be more efficient). On the other hand the problem to solve in this wouldn�t be your application, but rather the network itself.
Regards.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!