Hi Hubert,

I can not see any apparent failure in your mapping and this should normally work. The only thing that may cause problems is the mapping of ClassA which contains a collection mapping as the first none identity mapping. There had been a bug in that area that we resolved recently.

I suggest you to create a new issue at:

http://jira.codehaus.org/browse/CASTOR

and attach a junit test following:

http://castor.codehaus.org/how-to-submit-a-bug.html

for me to replay the problem.

Regards
Ralf


[EMAIL PROTECTED] schrieb:
Hallo erstmal,
i've tried the following with Castor 1.0.4 and 1.1 on an Oracle 10g database and in both cases ran into the same problem. my mapping: <class name="de.hbo.test.castor.ClassA" identity="id"> <map-to table="CLASSA"/> <field name="id" type="integer">
     <sql name="id" type="integer"/>
   </field>
<field name="children" type="de.hbo.test.castor.ClassB" collection="arraylist">
     <sql many-key="parentid"/>
   </field>
</class> <class name="de.hbo.test.castor.ClassB" identity="id"> <map-to table="CLASSB"/> <field name="id" type="integer">
     <sql name="id" type="integer"/>
   </field>
<field name="parent" type="de.hbo.test.castor.ClassA">
     <sql name="parentid"/>
   </field>
</class> <class name="de.hbo.test.castor.ClassC1" identity="id" extends="de.hbo.test.castor.ClassB"> <map-to table="CLASSC1"/> <field name="id" type="integer" >
     <sql name="id" type="integer"/>
   </field>
</class> <class name="de.hbo.test.castor.ClassC2" identity="id" extends="de.hbo.test.castor.ClassB"> <map-to table="CLASSC2"/> <field name="id" type="integer" >
     <sql name="id" type="integer"/>
   </field>
</class> I've the following table-entries CLASSA:
        ID
----------
         1
         2
CLASSB:
ID PARENTID
---------- ----------
         1          1
         2          2
         3          1
CLASSC1:
ID
----------
         1
         3
CLASSC2:
ID
----------
         2
and when trying to retrieve all ClassA-objects by running
 db.begin();
query = db.getOQLQuery("select a from de.hbo.test.castor.ClassA a"); result = query.execute(); List erg = new ArrayList();
 while (result.hasMore()) erg.add(result.next());
db.commit(); I got a [ClassA(id=1), ClassA(id=2), ClassA(id=1)] - list (with the two ClassA(id=1)-objects each having just a C1-child(id=1)) instead of a [ClassA(id=1), ClassA(id=2)] - list, which I thought I would get. Do I do something wrong or is it a bug?
There are two more things I found out, that maybe help you to help me.
1. When I change the database-entries as follows (the first two children belong to the first ClassA-Object(id = 1) and the third to the second ClassA-object(id = 2))
CLASSA:
        ID
----------
         1
         2
CLASSB:
ID PARENTID
---------- ----------
         1          1
         2          1
         3          2
CLASSC1:
ID
----------
         1
         3
CLASSC2:
ID
----------
         2
I get what I'm expecting.
2.
When I change the source-code as follows (and leave the database in its original state) ... //query = db.getOQLQuery("select a from de.hbo.test.castor.ClassA a"); query = db.getOQLQuery("select a from de.hbo.test.castor.ClassA a where id = $1");
 query.bind(new Integer(1));
... I get one ClassA-object(id = 1) with one C1- and one C2-child (as expected).
Thanks in advance,
Hubert.

--

Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
72127 Kusterdingen
Germany

Tel.   +49 7071 3690 52
Mobil: +49 173 9630135
Fax    +49 7071 3690 98

Internet: www.syscon.eu
E-Mail: [EMAIL PROTECTED]

Sitz der Gesellschaft: D-72127 Kusterdingen
Registereintrag: Amtsgericht Stuttgart, HRB 382295
Geschäftsleitung: Jens Joachim, Ralf Joachim

---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to