db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg von Frantzius <jfrantz...@web.de>
Subject Re: Detecting inconsistencies of mapped-by declarations?
Date Thu, 07 May 2009 20:01:15 GMT
I just happened to write:
> >> 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
Sorry that was utter nonsense. After thinking about really, it rather
seems to mean two mutually exclusive associations. So if an object of
type A is referenced by a B1 object through B1.a, there can be no B2
object referencing it through B2.a (and vice versa).

Implementing this using mapped-by would firstly lead to problems due to
impossibility of FK constraints, and secondly be one of the least
obvious and understandable ways of implementing it ;)

View raw message