-
1. Re: If CMR are not exposable to Remote clients, then how....
lcranford Jul 3, 2002 6:50 PM (in response to gzhong)>So does that mean that I need to write a separate function that creates another list of remote clients based on the list of local clients inside the UserBean class?
Yep
> Sounds twisted, no?
Yep. I guess they implemented CMR this way because of speed. A relationship with remote objects have the potential to have serious performance problems. But that should be left up to the architect of the app instead of the spec, IMHO. But here's a way to get around this restriction:
public Collection getRemoteProjects() throws EJBExcpetion
{
Iterator iter = getProjects().iterator();
Collection remoteProjects = new ArrayList();
while(iter.hasNext())
{
ProjectLocal projectLocal = (ProjectLocal)iter.next();
ProjectRemote projectRemote = projectRemoteHome.findByPrimaryKey(projectLocal.getPrimaryKey());
remoteProjects.add(projectRemote);
}
Hope that helps,
Lance -
2. Re: If CMR are not exposable to Remote clients, then how....
crackers Jul 5, 2002 11:47 AM (in response to gzhong)Actually, it would probably be better (at least that I've found) to use a Stateless SessionBean as a "front-end" to the EntityBeans (thereby accessing those via locals) and transfer serializable data objects (DOs) back and forth across the wire. The DO of the primary object contains collections of child DO objects and these map to the EntityBeans. The SLSB does the translation/validation between DO and EntityBean.