Discussion:
YADSQ. yet another dumb subclass question
Thomas Ganter
2005-03-11 14:33:53 UTC
Permalink
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
Anderson, Ken
2005-03-11 15:38:54 UTC
Permalink
Thomas,

First off, you have to make sure that every sub-entity of BARCODE has a single '=' qualifier in the Qualifier field like CATEGORY = 'ABC'. You should also make sure the super entity (BARCODE itself), has a qualifier that will not match anything, like CATEGORY = 'NONE'.

That should result in a single query. Can you tell us how you're fetching the BARCODE EO?

Ken

-----Original Message-----
From: eof-***@omnigroup.com [mailto:eof-***@omnigroup.com]On
Behalf Of Thomas Ganter
Sent: Friday, March 11, 2005 9:34 AM
To: ***@omnigroup.com
Subject: YADSQ. yet another dumb subclass question


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

Loading...