YADSQ. yet another dumb subclass question

Thomas Ganter <[email protected]> Fri, 11 Mar 2005 15:33:53 +0100
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
Hello world, 

perhaps I again answer my own question, but please confirm that I am not overseeing something here: 

I want to add barcode support for a system that supports multiple types of products that have completely different attributes and data models (and thus are stored in completely different tables). 

Barcodes are supposed to be stored in a database table, called BARCODE. 

BARCODE is (besides the barcode information) having two fields, one being PRODUCT_CATEGORY and the other one being PRODUCT_ID. 

Now, the Idea was to have subclasses of BARCODE, one for each category (using appropriate, disjoint qualifiers) that, in turn, each have a relationship to another product main description table (or whatever) using the PRODUCT_ID as a foreign key. 

Ideally, I then can retrieve one record from "BARCODE" which will by its Java class already know its type and the to_product() relationship will automatically retrieve the correct data. 

Unfortunately, I cannot get this to work properly (i.e. without multiple round trips to the database just for one fetch specification). 

Is this not possible, or am I simply missing something here?

Greetings, 

- Thomas