Hello:
I have a class that acts like a standard DAG node, i.e. it has multiple parents and children that are each DAG nodes. I am using the Xdoclet module to create the repository file and torque to create SQL and database. I am representing the parent and children relationships using an indirection table. My problem is this- the XDoclet module incorrectly generates the fk-pointing-to-element-class value. Below is the generated mapping file and corresponding java source. Notice that the
fk-pointing-to-element-class element for the children collection should have a value of "child_id".
If I manually change this value, then the mapping and sql are correct, and my program behaves as I expect.
Mapping snippet:
----------------------------
<class-descriptor
class="SimpleDAGNode"
table="effect"
>
<field-descriptor
name="ID"
column="ebo_id"
jdbc-type="VARCHAR"
primarykey="true"
length="35"
>
</field-descriptor>
<collection-descriptor
name="children"
element-class-ref="SimpleDAGNode"
indirection-table="parent_children_table"
auto-retrieve="true"
auto-update="true"
auto-delete="true"
>
<fk-pointing-to-this-class column="parent_id"/>
<fk-pointing-to-element-class column="parent_id"/>
</collection-descriptor> <collection-descriptor
name="parents"
element-class-ref="SimpleDAGNode"
indirection-table="parent_children_table"
auto-retrieve="true"
auto-update="true"
auto-delete="true"
>
<fk-pointing-to-this-class column="child_id"/>
<fk-pointing-to-element-class column="parent_id"/>
</collection-descriptor>
</class-descriptor>
--------------------Java source:
-----------------------------
public class SimpleDAGNode {/**
* @ojb.collection element-class-ref="com.alphatech.ebo.datamodels.SimpleDAGNode"
* auto-retrieve="true"
* auto-update="true"
* auto-delete="true"
* indirection-table="parent_children_table"
* foreignkey="parent_id"
*/
protected List children;
/** * @ojb.field primarykey="true" * column="ebo_id" * jdbc-type="VARCHAR" * length="35" */ protected String ID;
/**
* @ojb.collection element-class-ref="com.alphatech.ebo.datamodels.SimpleDAGNode"
* auto-retrieve="true"
* auto-update="true"
* auto-delete="true"
* indirection-table="parent_children_table"
* foreignkey="child_id"
*/
protected List parents;
------------------------------------
If I switch the order that parents and children are declared in the java file, the problem happens with parents, not children. Thus, it appears something is amiss in the XDoclet.
Thank you very much for your assistance, Brad
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
