hi vincent,

just to make it clear the attribute 'userId' is null because access is anonymous and no attribute is required in your class. the attribute 'user' should contain an instance of object User.

i do have a testcase for this feature and it works.

   <class-descriptor
      class="brj.ojb.Person"
      table="tabPerson"
   >
      <field-descriptor id="1"
         name="id"
         column="id"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"
         conversion="brj.ojb.TestFieldConversion"
      />
...

     <collection-descriptor
         name="konti"

collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
         orderby="saldo"
         sort="ASC"
         element-class-ref="brj.ojb.Konto"
         proxy="true"
             refresh="true"
         auto-retrieve="true"
         auto-update="true"
         auto-delete="true"
             >
         <inverse-foreignkey field-ref="idPerson"/>



   <class-descriptor
      class="brj.ojb.Konto"
      table="tabKonto"
    >
      <field-descriptor id="1"
         name="idKto"
         column="id"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"
      />
      <field-descriptor id="2"
         name="idPerson"
         column="idPerson"
         jdbc-type="INTEGER"
         access="anonymous"
      />
...
      <reference-descriptor
         name="inhaber"
         class-ref="brj.ojb.Person"
             >
         <foreignkey field-ref="idPerson"/>
      </reference-descriptor>



hth
jakob


Vincenz Braun wrote:


Hello,

I have the same problem described earlier in this list by
Gerhard Grosse. What is the status of this issue? Is someone
working on this or has at least committed a bug report? I queried
scarab and did not find a matching issue, yet.

Any help greatly appreciated.
Vincenz


original post from Gerhard Grosse:


tried to implement a bi-directional 1:n association between classes User and UserRole with an anonymous key in UserRole:

<class-descriptor
class="de.lexcom.noralinkojb.model.User"
table="OJB.USERS">
<field-descriptor
name="id"
column="ID"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"/>
<collection-descriptor
name="roles"
element-class-ref="de.lexcom.noralinkojb.model.UserRole"
auto-retrieve="true"
auto-update="true"
auto-delete="true">
<inverse-foreignkey field-ref="userId"/>
</collection-descriptor>
</class-descriptor>


<class-descriptor
        class="de.lexcom.noralinkojb.model.UserRole"
        table="OJB.USER_ROLES">

<field-descriptor
name="userId"
column="USER_ID"
jdbc-type="INTEGER"
primarykey="true"
access="anonymous"/>
<field-descriptor
name="role"
column="ROLE"
jdbc-type="INTEGER"
primarykey="true"/>
<reference-descriptor
name="user"
class-ref="de.lexcom.noralinkojb.model.User"
auto-retrieve="true">
<foreignkey field-ref="userId"/>
</reference-descriptor>
</class-descriptor>


When I now load a User object which has associated UserRoles, the user attribute of all UserRoles is null. The problem disappears when I make userId a normal attribute of UserRole.

Is this a known limitation of anonymous keys, is it a bug or am I doing something wrong here?



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to