db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Watzek <mwa.t...@spree.de>
Subject Managed 1-1 relationiships
Date Thu, 21 Jul 2005 18:23:12 GMT
Hi Craig, Erik, Andy,

testing 1-1 relationships I encountered that the JPOX enhancer generates 
code for managed relationships if the orm meta data contains attribute 
"mapped-by" on a field element. Thus setting one side of the 
relationship implies setting the other side, too. The decompiled 
enhanced code looks like this:

     public void setMentor(Employee mentor)
     {
         jdoSetmentor(this, mentor);
         jdoSetprotege(mentor, this);
     }
     public void setProtege(Employee protege)
     {
         jdoSetprotege(this, protege);
         jdoSetmentor(protege, this);
     }

I'm not sure if this is spec compliant. In chapter 15.3 the spec states:

"The field on the other side of the relationship can be mapped simply by 
identifying the field on the
other side that defines the mapping, using the mapped-by attribute. 
Changes to the field mapped via
“mapped-by” are not reflected in the datastore. There is no further 
relationship implied by having
both sides of the relationship map to the same database column(s). In 
particular, making a change
to one side of the relationship does not imply any runtime behavior by 
the JDO implementation to
change the other side of the relationship in memory, although the 
column(s) will be changed during
commit and will therefore be visible by both sides in the next transaction."

Regards,
Michael
-- 
-------------------------------------------------------------------
Michael Watzek                  Tech@Spree Engineering GmbH
mailto:mwa.tech@spree.de        Buelowstr. 66
Tel.:  ++49/30/235 520 36       10783 Berlin - Germany
Fax.:  ++49/30/217 520 12       http://www.spree.de/
-------------------------------------------------------------------

Mime
View raw message