Re: Implementing product attributes

From: Thomas Muller <>
Date: 2000/03/22
Message-ID: <jp2C4.20830$>#1/1

Thomas Muller <> wrote in message news:xG1C4.20775$
> Depending of the abstraction-layer approach, you may skip the 'encoding'
> 'type' field in the attribute-table. In a OO aproach, all "things" in the
> database should map to a class, and the the "thing" should inherently know
> how to handle it's attributevalues, thus enforcing validation checks on
> insertions and extractions.

To elaborate a little more: The model should be flexible enough to allow each product to take care of it's own attributes. Assume the attributevalues to be BLOB's, one could add a field 'handler' (BLOB) to the attribute_value table and serialize implementations of the following interface to it (Java)

public abstract interface AttributeHandler implements Serializable {

    public abstract void emit(OutputStream out, Object value) throws IOException;

    public Object extract(InputStream in) throws IOException; }

The handler-field allows for NULL values, in which case a default handler is used to extract the value.

When a product reads itself from the database, it associates an internal list of attributenames with the corresponding handler for rapid lookup/insertion later.


Received on Wed Mar 22 2000 - 00:00:00 CET

Original text of this message