db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg von Frantzius <joerg.von.frantz...@artnology.com>
Subject Re: Detecting inconsistencies of mapped-by declarations?
Date Thu, 07 May 2009 18:09:05 GMT
Erik Bengtson wrote:
>> in the XML metadata, it is possible to have multiple FCO fields, e.g.
>> B.a1 and B.a2, with identical mapped-by pointing to the same field of
>> the same related class, e.g. A.b. In effect this would theoretically
>> mean that the FK should be shared among different associations in the
>> object model. I don't think that this does make much sense.
> It makes sense to me, because a1 and a2 are distinct associations, thus
> different roles.
Why would you want to have two different fields for the same
association? As far as I can see, it would always hold true that
b.a1==b.a2. You could express that in OCL in your UML, but in most cases
in the jdo metadata the above would be an error. You could still have
another getter getA2() returning the same field a1 if you really want
that behaviour implemented.
>> Also it is possible to declare two fields in two different classes, e.g.
>> B1.a and B2.a, with the identical mapped-by pointing to the same field
>> of the same related class, e.g. A.a. That would mean that in theory two
>> FKs would have to be created for the same column, pointing to different
>> tables. That neither seems to make sense to me.
> It makes sense to me. Same as above.
> It's not common to handle these associations in relational databases, but
> very common when using UML.
In UML you'd have to write something like "for any b1 of type B1 and b2
of type B2: b1.a==b2.a" in OCL to express the above. Why should we
support implementing this using mapped-by if no database supports it?
Also, you can of course still implement this in other ways.

artnology GmbH - Milastraße 4 - 10437 Berlin - Germany
Geschäftsführer: Ekkehard Blome (CEO), Felix Kuschnick (CCO)
Registergericht: Amtsgericht Berlin Charlottenburg HRB 76376 
UST-Id. DE 217652550

  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message