----- Original Message ----- From: "Brandon Knitter" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; "Brandon Knitter" <[EMAIL PROTECTED]> Cc: "JBoss-user" <[EMAIL PROTECTED]>; "David Russell" <[EMAIL PROTECTED]>; "Paul Kavanagh" <[EMAIL PROTECTED]>; "Andre Selton" <[EMAIL PROTECTED]> Sent: Wednesday, June 12, 2002 2:42 AM Subject: [JBoss-user] What's best practice for remote calls?? Solved: SOOO close to CMR (1-to-many) working...I may just wet myself! :)
> Okay, I figured it out!! I was calling getPlaylists, which returns the Local > objects...naughty naughty! :) > > So I implemented a getRemotePlaylists method and that seems to work great! > WOOHOO! :) Thanks for being patient with me! :) > > Anyhow, since I do intend to my EJBs in a Local model, I'm not worried about the > naming convention, but I cam curious as to what the standard practice is. I > have the following in my code to cope with this, is this the right way to do > things?? > > public abstract Collection getPlaylists(); > public abstract void setPlaylists(Collection value); > > public Collection getRemotePlaylists() { > Vector rc=new Vector(); > > try { > Properties p=new Properties(); > p.put("java.naming.factory.initial", > "org.jnp.interfaces.NamingContextFactory"); > p.put("java.naming.provider.url", "jnp://localhost:1099"); > p.put("java.naming.factory.url.pkgs", > "org.jboss.naming:org.jnp.interfaces"); > InitialContext iniCtx = new InitialContext(p); > Context ejbCtx=(Context) iniCtx.lookup("comp/env/ejb"); > PlaylistHome home=(PlaylistHome)ejbCtx.lookup("Playlist"); > > Iterator it=getPlaylists().iterator(); > while(it.hasNext()) { > PlaylistLocal pll=(PlaylistLocal)it.next(); > rc.add(home.findByPrimaryKey(pll.getPlaylistId())); > } > } catch (Exception ex) { > throw new EJBException (ex); > } > > return(rc); > } > > > Ignore the fact that I have all the naming stuff hardcoded and such! Is this > the proper way to do things? > > Thanks in advance!! Hello ! I t seems too much hand-coding as for CMP solutions. And not effective: calling finder for every position you will kill db with bigger selects !!!. Imagine 100 000 records returned and 100 000 additional selects called ! Sun advises to use ValueObjcets as a container to store data to avoid passing the Bean Interface to remote cleint. sincerely Olek _______________________________________________________________ Sponsored by: ThinkGeek at http://www.ThinkGeek.com/ _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user