Hi all,

I'm fairly new to OJB and O/R in general, so please forgive me
if I ask for something obvious.

I have a complex inheritance schema that can be represented in
pseudo-Java this way (I use fields in interface instead of
writing get/set pairs and I forget about field access levels)

interface Super {
  Long id;

  String a1;
}

interface Sub1 extends Super {
  Long id;

  String a2;
}

interface Sub2 extends Super {
  Long id;

  String a3;
}

interface SubSub1 extends Sub1 {
  Long id;

  String a4;
}

interface MostDerived extends SubSub1, Sub2 {
  Long id;

  String a5;
}


As you can see, this corresponds to a diamond inheritance
diagram:

      Super
      /   \
     /     \
   Sub1   Sub2
    |       |
    |       |
  SubSub1   !
     \     /
      \   /
       \ /
    MostDerived

This complex schema can be implemented using interface
inheritance and delegation between implementing classes:

class Sub1_impl implements Sub1 {
  private Super delegateSuper;
...
}

...

class MostDerived_impl implements MostDerived{
  private SubSub1 delegateSubSub1;
  private Sub2 delegateSub2;
...
}

Suppose now also that I want a new "Assoc" interface/class that
has three links to Super, Sub1, SubSub1 respectively.

Here come my questions:

1) In the mapping document, do I need to map these links as links
to the concere classes or I can map them as links to interfaces
(in the features page, I can see that interface attributes are
supported) ? How do associations with interfaces work? Which table
they correspond to?

2) I could as well map the links as links to the concrete classes.
Query polymorphism is achieved by listing interfaces in the mapping
document, objetc navigation polymorphism can be "simulated"
provided that "Super_impl", "Sub1_impl" and "SubSub1_impl" have a
reverse link (possibly null) to their subclass part.

In this latter case, can I mantain some choice about mapping?
Do I need to map all mixins to different tables or am I able
to store, for example, "Sub1_impl" and "SubSub1_impl" parts of
a "SubSub1" logical object in the same table without joins (i.e.
on the same row)?

Thanks in advance for your attention and time.

Fabio T.
[EMAIL PROTECTED]
-----------------



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to