1 Reply Latest reply on Nov 21, 2002 6:48 AM by Tim

    relations,object model and EntityBean's

    Tim Newbie

      Could someone offer some clarification on the following points please.

      Background:

      1) EntityBean's are an abstraction that currently are persisted using an RDB in the case of CMP.
      2) CMP is supposed to save a lot of greif in making relationships between ejb's declarative.

      This is ++good.

      Problem:

      1) Why then are folks coding classes with cludge fields like widjet_group_fk_id in a widget object to define / assist in a relation mapping to say a widget_group object
      These are supposed to be objects not RDB tables.
      Examples like this are in the xdoclet CMR sample code.
      CMP is not an RDB its just happens to use an RDB for persistence.

      2) Surely if we have declared a relation mapping that says X is a 1-n relation to Y then that should be necessary and sufficient for CMP to manage without these xxx_fk redundant fields. If Y has a PK object then surely that is all that is needed for CMP to enable X to reference it. The fact that it is persisted to an RDB should not even be a consideration. As a total abstraction consider the backend being and object db like ozone where there is not a concept of fk's. It's all objects.

      Any fk cmp field reference from Y embedded in X breaks abstraction / isolation in the object model. Particulary if Y cannot be indentified by a single key field. And what if that key field changes type, or the key becomes multiple fields.

      In short it seems folks are coding RDB concepts into objects.

      My question is why is this so?