Could it be that the getter/setter in class B for attribute AId is
get/setAId()?
I believe the correct name for the attribute in the mappings file would
be 'aId' instead of 'AId'...

Please correct me if I'm wrong... but this kind of error has been
appearing to me when there is no setter for a mapped attribute

Jorge

 
________________________________________________________________________
   inesc-id   Jorge Martins              | [EMAIL PROTECTED]
lisboa        Software Engineering Group |
http://www.esw.inesc-id.pt/~jorge



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: sexta-feira, 29 de Novembro de 2002 11:35
To: [EMAIL PROTECTED]
Subject: 1->n association


Hello, does anyone have a working example of 1->n association? Let's say
I have a A class that holds several reference of B objects. Thus I have
A->*B

In my java source code I got:
A {
  int id;
  Vector listOfB = new Vector();

  public void addB(B BObject) {
    listOfB.add(BObject);
  }

  getter and setter methods...

}


B {
  int id;
  int AId;

 getter and setter methods...
}


in my reference_user.xml file I have :
<class-descriptor name="A" table="TABLE_A">
  <field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER"
primarykey="true" autoincrement="true"/>
  <collection-descriptor name="listOfB" element-class-ref="B">
  <inverse-foreignkey field-id-ref="2"/>
  <collection-descriptor/>
<class-descriptor/>

<class-descriptor name="B" table="TABLE_B">
  <field-descriptor id="1" name="id"  column="ID" jdbc-type="INTEGER"
primarykey="true" autoincrement="true"/>
  <field-descriptor id="2" name="AId" column="A_ID"
jdbc-type="INTEGER"/> </class-descriptor>


When executing, I get exceptions :
Error in operation [set] of object [PersistentFieldPropertyImpl],
java.lang.IllegalAccessException Declaring class [B] Property Name [AId]
Property Type [int] anObject was class [B] aValue was class
[java.lang.Integer]

Can anyone help, please? I just want a working java source code with the
repository_user.xml.

Thanks





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

Reply via email to