I need to persist an object that contains a collection of other objects of the same class. Specifically, the Group class has a collection of childGroups (please see the portion of the mapping file included below). When I try to access a group via Castor, though, I get the following error:
java.sql.SQLException: Table not found: GROUPS_F2 in statement [SELECT a2.name,usergroup.userguid,Groups_f2.guid,a2.parentGroupGuid,a2.groupTyp eGuid,a2.allowOverrideNegative,a2.allowOverridePositive FROM Groups a1 LEFT OUTER JOIN usergroup ON (a1.guid=usergroup.groupguid),Groups a2 LEFT OUTER JOIN Groups_f2 ON (a2.guid=Groups_f2.parentGroupGuid) WHERE a2.guid=a1.guid AND a2.guid='207017200171106868233452300008']
This error makes perfect sense, as there is no table called Groups_f2. If I make Groups_f2 an alias of Group and run the query manually, it executes, but gives me the object's parent's guid instead of the object's guid...
Is there something wrong with my design? Execution? Do I need to map the children through a separate table? I'm a bit stumped.
I'm using Castor 0.9.5.2 and HSQL 1.7.1.
Here is the relevant portion of my mapping file:
<class name="com.khiasm.horae.Group" key-generator="UUID" identity="guid">
<map-to table="Groups" xml="Groups" />
<field name="name" type="string">
<sql name="name" />
<bind-xml name="name" />
</field>
<field name="guid" type="string">
<sql name="guid" />
<bind-xml name="guid" />
</field>
<field name="users" collection="collection" type="com.khiasm.horae.UserImp">
<sql name="userguid" many-table="usergroup" many-key="groupguid" />
<bind-xml name="users" />
</field>
<field name="childGroups" collection="collection" type="com.khiasm.horae.Group">
<sql many-key="parentGroupGuid" />
<bind-xml name="childGroups" />
</field>
<field name="parentGroupGuid" type="string">
<sql name="parentGroupGuid" />
<bind-xml name="parentGroupGuid" />
</field>
<field name="groupTypeGuid" type="string">
<sql name="groupTypeGuid" />
<bind-xml name="groupTypeGuid" />
</field>
<field name="allowOverrideNegative" type="boolean" get-method="isAllowOverrideNegative" set-method="setAllowOverrideNegative">
<sql name="allowOverrideNegative" />
<bind-xml name="allowOverrideNegative" />
</field>
<field name="allowOverridePositive" type="boolean" get-method="isAllowOverridePositive" set-method="setAllowOverridePositive">
<sql name="allowOverridePositive" />
<bind-xml name="allowOverridePositive" />
</field>
</class>
Thanks, Dan -- Dan Check
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
