This one time, at band camp, Dan Check said:
DC>Hi,
DC>
DC>I need to persist an object that contains a collection of other
DC>objects of the same class. Specifically, the Group class has a
DC>collection of childGroups (please see the portion of the mapping file
DC>included below). When I try to access a group via Castor, though, I
DC>get the following error:
DC>
DC>java.sql.SQLException: Table not found: GROUPS_F2 in statement
DC>[SELECT
DC>a2.name,usergroup.userguid,Groups_f2.guid,a2.parentGroupGuid,a2.groupTyp
DC>eGuid,a2.allowOverrideNegative,a2.allowOverridePositive FROM Groups
DC>a1 LEFT OUTER JOIN usergroup ON
DC>(a1.guid=usergroup.groupguid),Groups a2 LEFT OUTER JOIN Groups_f2 ON
DC>(a2.guid=Groups_f2.parentGroupGuid) WHERE a2.guid=a1.guid AND
DC>a2.guid='207017200171106868233452300008']
DC>
DC>This error makes perfect sense, as there is no table called
DC>Groups_f2. If I make Groups_f2 an alias of Group and run the query
DC>manually, it executes, but gives me the object's parent's guid
DC>instead of the object's guid...
DC>
DC>Is there something wrong with my design? Execution? Do I need to
DC>map the children through a separate table? I'm a bit stumped.
DC>
DC>I'm using Castor 0.9.5.2 and HSQL 1.7.1.
DC>
DC>Here is the relevant portion of my mapping file:
DC> <class name="com.khiasm.horae.Group" key-generator="UUID" identity="guid">
DC> <map-to table="Groups" xml="Groups" />
DC> <field name="name" type="string">
DC> <sql name="name" />
DC> <bind-xml name="name" />
DC> </field>
DC> <field name="guid" type="string">
DC> <sql name="guid" />
DC> <bind-xml name="guid" />
DC> </field>
DC> <field name="users" collection="collection"
DC>type="com.khiasm.horae.UserImp">
DC> <sql name="userguid" many-table="usergroup" many-key="groupguid" />
DC> <bind-xml name="users" />
DC> </field>
DC> <field name="childGroups" collection="collection"
DC>type="com.khiasm.horae.Group">
DC> <sql many-key="parentGroupGuid" />
DC> <bind-xml name="childGroups" />
DC> </field>
DC> <field name="parentGroupGuid" type="string">
DC> <sql name="parentGroupGuid" />
DC> <bind-xml name="parentGroupGuid" />
DC> </field>
DC> <field name="groupTypeGuid" type="string">
DC> <sql name="groupTypeGuid" />
DC> <bind-xml name="groupTypeGuid" />
DC> </field>
DC> <field name="allowOverrideNegative" type="boolean"
DC>get-method="isAllowOverrideNegative"
DC>set-method="setAllowOverrideNegative">
DC> <sql name="allowOverrideNegative" />
DC> <bind-xml name="allowOverrideNegative" />
DC> </field>
DC> <field name="allowOverridePositive" type="boolean"
DC>get-method="isAllowOverridePositive"
DC>set-method="setAllowOverridePositive">
DC> <sql name="allowOverridePositive" />
DC> <bind-xml name="allowOverridePositive" />
DC> </field>
DC> </class>
Dan,
My apologies for not responding to your message sooner. I simply missed
it on the list. Luckily this same problem was just brought to my attention
by a similar situation:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg16229.html
I have filed a Bugzilla report for this issue because I believe it's a
bug in the way that self-join (objects of the same type that are related)
aliases are generated:
http://bugzilla.exolab.org/show_bug.cgi?id=1483
Officially Castor JDO does not support self-joins, but I'm going to fix
this bug and see if we can get at least a step further.
Thanks for your patience.
Bruce
--
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'
The Castor Project
http://www.castor.org/
Apache Geronimo
http://incubator.apache.org/projects/geronimo.html
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev