db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Russell <Craig.Russ...@Sun.COM>
Subject Re: tck test status
Date Tue, 24 May 2005 21:55:39 GMT
Hi Andy,

In the company package.jdo, some of the information you need is there

         <class name="Employee"
             identity-type="application"
             <field name="reviewedProjects" 
persistence-modifier="persistent">
                 <collection 
element-type="org.apache.jdo.tck.pc.company.Project"/>
...
         <class name="Project"
             identity-type="application"
             objectid-class="org.apache.jdo.tck.pc.company.Project$Oid">
             <field name="projid" primary-key="true"/>
             <field name="reviewers" persistence-modifier="persistent">
                 <collection 
element-type="org.apache.jdo.tck.pc.company.Employee"/>
             </field>
...

In the company-derby.orm, the Project is mapped thus:

         <class name="Project" table="projects">
             <field name="projid" column="PROJID" primary-key="true"/>
             <field name="reviewers" table="project_reviewer">
                 <join column="PROJID"/>
                 <element column="REVIEWER"/>
             </field>

And the Employee:

         <class name="Employee">
          <field name="reviewedProjects" mapped-by="reviewers"/>

 From this mapping of reviewers, you know that the project_reviewer 
table contains a column referring to Project called PROJID, and a 
column referring to the Employee called REVIEWER. When you have a 
mapped-by attribute, you need to invert the mapping for the other side, 
so the join column on the Employee side is REVIEWER, and the reference 
to the other side is PROJID.

 From the types of both fields, reviewers and reviewed_by, you have the 
collection element types.

I don't know what more information is needed in order to map this. 
Could you explain your algorithm and tell us where you arrive which 
needs more information?

I do have an action item for Chapter 15 that should explain this better.

Thanks,

Craig


On May 24, 2005, at 2:25 PM, Andy Jefferson wrote:

>> Below is a summary four test errors that are responsible for 90 out 
>> of a
>> total of 115 errors when running the tck on jpox/derby.  The fourth 
>> one
>> listed is a test cleanup problem logged as JIRA JDO-48.  Could the 
>> JPOX
>> team please take a look at the others?
>
>> test(org.apache.jdo.tck.query.Cast)javax.jdo.JDOUserException: Field
>> "org.apache.jdo.tck.pc.company.Employee.reviewedProjects" has been
>> defined as "mapped-by" the field
>> "org.apache.jdo.tck.pc.company.Project.reviewers" yet this is of an
>> incorrect type (java.util.Set). The field that is set as the 
>> "mapped-by"
>> must be of type "org.apache.jdo.tck.pc.company.Employee"
>
> Well you have a MetaData specification that has a "mapped-by" that 
> points to a
> Set object in the other class. Is this to represent a M-N or 1-N
> relationship ? I see nothing in the JDO 2 spec that defines the 
> metadata for
> M-N relationships. Would be nice if the spec included a definition of 
> what
> implementations are supposed to accept because without it, it is left 
> open to
> interpretation, which is a bad thing.
>
> JPOX requires that any mapped-by field is of the type of the class 
> that it is
> defined in.
>
> With 1-N :-
> class A
> {
>     Set b;
> }
> class B
> {
>     A a;
> }
> You define the metadata for A field b to have a mapped-by as "a".
>
>
> With a M-N :-
> class A
> {
>     Set b;
> }
> class B
> {
>     Set b;
> }
> With JPOX currently you don't use mapped-by, and you use <join/> 
> because for a
> M-N you need a join. I see no <join> in the SVN metadata.
>
> HTH
> --
> Andy
> JPOX - Java Persistent Objects
>
Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!

Mime
View raw message