The jdoLoad() behavior is deprecated. The original support of polymorphic method is removed. Please search the mail archive.
Thomas -----Original Message----- >From: Gollot [mailto:[EMAIL PROTECTED]] >Sent: Thursday, November 08, 2001 6:20 AM >To: [EMAIL PROTECTED] >Subject: [castor-dev] Class cast and child class > >Hello, > >I tried, using the Castor JDO example, to load all Product objects (Product >class) and to cast some of same into Computer class which is a derived class >of the Product class. > >I tried this with this code : > >OQLQuery allProductsQuery = db.getOQLQuery("SELECT p FROM myapp.Product >p"); > boolean isComputer = false; > > results = allProductsQuery.execute(); > while (results.hasMore()) { > product = (Product)results.next(); > if (product.getId() == 6) // 6 is a computer > isComputer = true; > writer.println(product.getId() + " : is a " + >product.getName() ); > if (isComputer) { > Computer comp = (Computer)product; > writer.println(" CPU : " + comp.getCpu()); > } > >In th jdoLoad method of Product class, a test is done on the name of the >product and if this name is a PC name, Computer.class is returned. > >The previous code does not work !! > >How can i do that ? > >----------------------------------------------------------- >If you wish to unsubscribe from this mailing, send mail to >[EMAIL PROTECTED] with a subject of: > unsubscribe castor-dev > ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
