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