• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

narrow(java.lang.Object, java.lang.Class) parameters

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working on SessionFacade/DTO's. I created a test client for the Members table and used an iterator to loop through the values. The code is below:

try {
Integer sMemberId = new Integer("1");
Collection c = client.findByDocNames(sMemberId);
Iterator i = c.iterator();
while (i.hasNext()) {
MasterDocCatalogRemote mcr = (MasterDocCatalogRemote)PortableRemoteObject.narrow(i.next(),MasterDocCatalogRemote.class);
System.out.println("DocId = " + mcr.getMasterDocId() + " DocName = " + mcr.getDocName());
}
} catch (Exception ex) {
ex.getStackTrace();
System.out.println("Exception = " + ex);
}

The SessionFacade/DTO's is returning an array of MasterDocCatalogDto[]. I want to be able to loop through and see values. I need an object and class for the narrow parameters and i am not sure what needs to be placed in the object parameter. The code is listed below:

try {
Integer sMemberId = new Integer("1");
int i;
MasterDocCatalogDto[] c = client.masterDocCatalogFindByDocNames(sMemberId);
for (i=1; i lessthan c.length; i++) {
MasterDocCatalogRemote mcr = (MasterDocCatalogRemote)PortableRemoteObject.narrow(???, MasterDocCatalogRemote.class);
System.out.println("DocId = " + mcr.getMasterDocId() + "DocName = " + mcr.getDocName());
}
} catch (Exception ex) {
ex.getStackTrace();
System.out.println("Exception = " + ex);
}


Can someone set me staight???
 
Sheriff
Posts: 4012
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chuck, welcome to JavaRanch.

You've landed in the Cattle Drive forum, where the discussions are pretty much limited to the Cattle Drive. You'd have better luck getting help in a different forum, so we'll get this moved for you. Hang on a sec...


Pauline
[ May 27, 2004: Message edited by: Pauline McNamara ]
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds kind of like a CORBA question to me, so I'm going to move this to the Distributed Java forum for further discussion.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, this looks more like an EJB question... ( sorry for moving your question all over the 'ranch )

But I don't think the cast isn't needed in the first place if I am understanding the question correctly... isn't the point of a DTO to pass a serialized version of the data inside the class rather than a reference to the class itself? If the DTO objects you're getting is just serialized data then there's no reason to do the narrow - you only need to narrow remote references that you receive.
 
what if we put solar panels on top of the semi truck trailer? That could power this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic