[Opensource] details bug

larry hamel expresso at codeguild.com
Thu Aug 22 12:08:28 PDT 2002


Hello,

I think that there is a bug in the underlying representation of details (foreign key relations) in DBObject.

For example, consider a Node class which has relations with other node instances, and these relations are represented in a Relation class.  A given node could be the source of a relation, or the destination of a relation.  The Node class then would have two addDetail() lines with the Relation class:

                addDetail(Relation.class.getName(), this.NODE_ID, Relation.RELATION_SRC);
                addDetail(Relation.class.getName(), this.NODE_ID, Relation.RELATION_DEST);

But this does the wrong thing because the underlying implementation in DBObjectDef which captures the details is a hash table:

    synchronized void addDetail(String objName, String keyFieldsLocal,
                                String keyFieldsForeign)
                         throws DBException {
        detailObjsLocal.put(objName, keyFieldsLocal);
        detailObjsForeign.put(objName, keyFieldsForeign);
    }

With this implementation, there can be only one detail association between any two classes.

I'm working on an old version of Expresso right now, so it will take me a while to get around to fixing this.

Let me know if you see a problem with this analysis, and feel free to fix this before I get there.

Larry




More information about the Opensource mailing list