You mean that we cannot retrieve child classes usin an OQL statement that
query the parent class ?
If yes, it will be difficult to use Castor to persist the following
situation :
1 *
A ----- D
| |
--- ---
B C E F
B & C inherit from A, E & F inherit from D, an association 1-N exist
between
A & D, I map all classes into a table (6 tables).
I'm wrong with the Castor mechanism ?
-----Original Message-----
>Date: Thu, 8 Nov 2001 14:31:07 -0800
>From: "Thomas Yip" <[EMAIL PROTECTED]>
>Subject: RE: [castor-dev] Class cast and child class
>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 ?
>>
=========================================================================
Ce message et toutes les pi�ces jointes sont propri�t� de VALTECH et
susceptibles de contenir des informations confidentielles � l'intention
exclusive de ses destinataires. Si vous avez re�u ce message par erreur
ou si celui ci vous est parvenu incomplet ou alt�r�, merci d'en avertir
l'exp�diteur par retour.Toute utilisation, diffusion ou publication non
express�ment autoris�e par nous par �crit est strictement interdite.
--------------------------------------------------------------------------
This message and any attachments are Valtech property and may contain
iconfidential information intended solely for the addressees. If your are
not the intended recipient of this message or if you have received it
uncomplete or altered, please notify the author by replying to his e-mail
immediately. Any unauthorised use, diffusion or dissemination not
expressly authorised by us in writing is strictly prohibited.
=========================================================================
Copyright Valtech 2000
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev