Thanks for your efforts Bruce et al.. I have a couple of follow-up questions.
1) Any guess as to time frame for a fix for a bug like this? It would help guide me in how much effort to put into a work-around or refactoring. 2) We have a couple of sr. java programmers here are interested in looking at the castor code to help find the problem if that is not a huge undertaking. Does anyone on the development team have a strong suspicion of where to look in the castor code? e.g. is it how the instances are loaded, or how they get persisted back out, and if so, what part of the code base would they start looking at. 3)In anyone's opinion this a bug that has crept in or has it not ever been tested before now? Thanks again to you and the rest of the Castor developers and community! Rich Schramm -----Original Message----- From: Bruce Snyder [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 6:25 AM To: [EMAIL PROTECTED] Subject: Re: [castor-dev] JDO inheritance problem This one time, at band camp, Schramm, Rich said: SR>It might be easier demo the problem Im having by using the jdo examples. It seems to me a reasonable thing to want to do is update the price of all products in the database... however in the examples, Computer extends Product. Test.java creates a computer instance with Id = 11, there are also generic products created, eg one with Id = 4. If you add the following bits of code at the bottom of test.java... updating the price of the selected product... it fails in the last case.... where "Product" happens to also be a "Computer" SR>I get: IllegalArgumentException: object is not an instance of declaring class SR> SR>I cant seem to grock a casting strategy that works correctly for Products if they happen to be Computers.. SR>(Note..There is a jdoLoad method in Product.java that tests the name field for 'PC' and returns a Class.Computer but that doesnt seem to change the outcome (I tried changing name 'myPC' to 'foobar').) SR> SR>I think if I can get past this simple example it might just get me past my more complicated real-life problem (wishfull thinking...) Thanks again for any suggestions! Rich, I think that this may be an issue with Castor not walking the inheritance tree. I changed to the code to also try the following and I receive a slightly different exception: /**** price update FAILS for Product id = 11 (a computer) ***/ db.begin(); productOql.bind( 11 ); results = productOql.execute(); if ( !results.hasMore() ) { writer.println("Query failed"); } else { // product = (Product)results.next(); computer = ( Computer ) results.next(); // writer.println("Found Product: " + product.toString() ); writer.println("Found Computer: " + computer.toString() ); // product.setPrice(999); computer.setPrice(999); } db.commit(); I'll file a Bugzilla report on this issue and attach your code additions to the JDO examples. Bruce -- perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");' ----------------------------------------------------------- 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
