hi don,

thanks a lot for the hint, the problem is now solved.
this bug nearly drove me crazy.
is it documented somewhere ? i think it will hit many other who download 0.9.3

jakob

----- Original Message -----
From: Don DeLuca
Sent: Wednesday, October 10, 2001 6:11 PM
Subject: Re: [castor-dev] 1:n Relationship does not work

I believe I ran into the same problem you are having.  This was a bug that was fixed.  I downloaded a nightly build and the problem was solved.
 
-- Don
 
-----Original Message-----
From: Jakob Braeuchi [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 10, 2001 11:35 AM
To: [EMAIL PROTECTED]
Subject: [castor-dev] 1:n Relationship does not work

hi,
 
my 1:n relationship does not work, im completely lost ! i have a person with many accounts, the account has a backpointer to the person. persons without accounts in the database get the same arraylist of accounts !!!
 
the follwing snippet shows a person with accounts (person with id=1) and a person without accounts (person id = 2).
the line Konti: shows the hashCode of the arraylist witch is identical for person 1 and 2.
Konto  id=1 .... inhaber = Br�uchi  (inhaber is the backpointer)
 
[test] Castor: Loading brj.Konto (1)
[test] Castor: Loading brj.Konto (2)
[test] Castor: Loading brj.Person (1)
Person  id=1 vorname=Jakob name=Br�uchi geb=1959-12-11 adr=Bottigenstrasse 102, 3018 Bern test=11 boss=false
Konti:343852236
Konto  id=1 nummer=BRJ-1 saldo=123.50 inhaber = Br�uchi        <<<< backpointer ok
Konto  id=2 nummer=BRJ-2 saldo=345678.90 inhaber = Br�uchi
 
[test] Castor: Loading brj.Person (2)
Person  id=2 vorname=Christof name=Schnyder geb=null adr= test=12 boss=true
Konti:343852236                <<<< actually person 2 has NO accounts but is the same arraylist as for person 1 >>>>
Konto  id=1 nummer=BRJ-1 saldo=123.50 inhaber = Br�uchi
Konto  id=2 nummer=BRJ-2 saldo=345678.90 inhaber = Br�uchi
...
[test] Castor: Loading brj.Konto (6)
[test] Castor: Loading brj.Person (5)
Person  id=5 vorname=Reto name=Hofstetter geb=null adr=null test=89 boss=false
Konti:2080284856            <<<< person 5 has only ONE account  >>>>
Konto  id=1 nummer=BRJ-1 saldo=123.50 inhaber = Br�uchi            <<<< backpointer WRONG
Konto  id=2 nummer=BRJ-2 saldo=345678.90 inhaber = Br�uchi       <<<< backpointer WRONG
Konto  id=6 nummer=RETO-1 saldo=250.60 inhaber = Hofstetter      <<<< backpointer ok
 
<mapping>
 
  <class name="brj.Person" identity="id" key-generator="IDENTITY">
    <map-to table="tabPerson" />
    <field name="id" type="integer">
      <sql name="id" type="integer"/>
    </field>
    ...
    <field name="konti" type="brj.Konto" required="true" collection="arraylist">
      <sql many-key="idPerson"/>
    </field>
 
  </class>
 
  <class name="brj.Konto" identity="id" key-generator="IDENTITY">
    <map-to table="tabKonto" />
    <field name="id" type="integer">
      <sql name="id" type="integer"/>
    </field>
    ...
    <field name="inhaber" type="brj.Person">
      <sql name="idPerson" />
    </field>   
  </class>

</mapping>
 
thanks for help
 
jakob

Reply via email to