----- Original Message -----
Sent: Thursday, July 11, 2002 10:45
AM
Subject: [castor-dev] CALL SQL and One to
Many relationships problem
I have been looking at castor for a while now and
have come across the following error(s);
I have a couple of tables that implement a one to
many relationship and I am trying to query for it directly using CALL
SQL
my mapping is as follows:
<mapping>
<class name="myObject" identity="id">
<description></description>
<map-to table="dev.object" />
<field name="a" type="string" >
<sql name="a" type="varchar"/>
</field>
<field name="b" type="string" >
<sql name="b" type="varchar"/>
</field>
<field name="c" type="cObject" collection="collection" lazy="true"
required="false">
<sql many-key="mid"/>
</field>
</class>
<class name="cObject" identity="id">
<description></description>
<map-to table="dev.cobject" />
<field name="id" type="integer" >
<sql name="id" type="integer"/>
</field>
<field name="a" type="string">
<sql name="a" type="varchar"/>
</field>
</class>
I am then using the following OQL to query for the
objects
CALL SQL SELECT id, a, b FROM dev.object AS myObject
I expected this to return me the objects but without the cObjects (as I
havn't done the INNER JOIN)...??? Is this
correct...?
However, first of all I get a
NullPointerException in createCall in SQLEngine because I havn't provided a
sql name attribute for the many object in my myObject class....I have
done a quick fix for this but it leads to another problem.....In SQLTypes it
appears to still try and populate the many fields in getObject() so fails
with a SQLException: Invalid column index....
Is it intended that castor JDO should support
this type of query....?
Any help would be gratefully
received....
Thanks
Brett
Cherrington