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 Fri, 08 May 2009 12:42:37 GMT
Erik Bengtson wrote:
>> 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.
>>     
>
> It's not the same association. There are two associations in here, and they
> are probably meant to be used exclusively.
>   
If that's supposed to be two different associations, then they should
have distinct fields on both ends? You're not talking about n-ary
associations here, are you?

If not, then at least the UML doesn't allow different associations to
share ends. If you look at Figure "7.12 - Classes diagram of the Kernel
package" in UML2 superstructure 2.1.2 (07-11-02), you'll see that class
Association has a containment association to class Property that
includes its memberEnds, so a Property can belong only to one association.
>   
>> 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.
>>     
>
> Why not? We can add one column that preserves the role name(example 1) of
> the association or the class name(example 2) that has the association
> instance.
>   
That was unfortunately complete nonsense what I wrote there, please see
my own answer to my email. Talking about the UML2, it would rule out
this case as well. You simply cannot model the sharing of association
ends in UML2.
>
> I think we can raise a warning if the user tries to map such situations, but
> throwing an error would be a blocker for advanced usage.
>   
I didn't understand yet what the purpose of that usage would be? How
would you express your intentions in UML2?


-- 
____________________________________________________________________
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


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