db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Braeuchi <jbraeu...@gmx.ch>
Subject [anonymous fields] querying fields of "Multiple Joined Tables"
Date Fri, 15 Aug 2003 18:27:40 GMT
hi all,

armin found a problem in the testcase which uses attributes of the super 
class in a query.
the situation is as follows:

 <class-descriptor
        class="org.apache.ojb.broker.ObjectRepository$E"
        table="TABLE_E">
 ...
        <field-descriptor
            name="someSuperValue"
            column="SOMESUPERVALUE"
            jdbc-type="INTEGER"
        />

 </class-descriptor>

 <class-descriptor
        class="org.apache.ojb.broker.ObjectRepository$F"
        table="TABLE_F">
...
        <field-descriptor
            name="eID"
            column="E_ID"
            jdbc-type="INTEGER"
            access="anonymous"
        />

        <field-descriptor
            name="someValue"
            column="SOMEVALUE"
            jdbc-type="INTEGER"
        />

          <reference-descriptor name="super"
              class-ref="org.apache.ojb.broker.ObjectRepository$E"
            <foreignkey field-ref="eID" />
          </reference-descriptor>
    </class-descriptor>


when querying for 'F' using attributes of 'F' (someValue) everything is 
ok. but using attributes of the super E (someSuperValue) does not work 
because there's no real relationship between 'F' and 'E'.
i could solve the problem by adding the name 'super' to the appropriate 
anonymous field:

   public AnonymousPersistentFieldForInheritance(ClassDescriptor cld)
   {
       super("super");
       this.cld = cld;
   }

in the query the attribute of class 'E' has to be prefixed by 'super':

       c.addEqualTo("super.someSuperValue", new Integer(key2));

this works, but we loose transparency :(

what do you think ???

jakob




---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message