David Zejda wrote:
SCENARIO:
There are 2 classes:
abstract class Abstract class Sub extends Abstract
where Abstract contains collection of Sub type.
PROBLEM:
There are foreign-key tags missing in Torque schema generated by XDoclet.
EXAMPLE:
/** * @ojb.class include-inherited="true" */ public class Sub extends Abstract { }
/** * @ojb.class include-inherited="true" */ public abstract class Abstract { /** * Artificial ID key holder * * @ojb.field nullable="false" * autoincrement="ojb" * primarykey="true" */ private int a_id;
/** * @ojb.field nullable="false" * column="CLASS_NAME" * jdbc-type="VARCHAR" * length="128" */ private String ojbConcreteClass = this.getClass().getName();
/** * @ojb.collection element-class-ref="test.Sub" * foreignkey="ab_id" * remote-foreignkey="su_id" * indirection-table="ABSTRACT_SUBS" * auto-retrieve="true" * auto-update="true" * auto-delete="true" */ private Sub[] a; }
generated:
... <table name="ABSTRACT_SUBS"> <column name="ab_id" type="INTEGER" /> <column name="su_id" type="INTEGER" /> </table> ...
This was a conscious decision. The analysis necessary to determine which foreignkeys would be necessary for indirection tables is not trivial (esp. when mixing sub-class-mapping to one table via ojbConcreteClass, and multiple-joined-tables-mapping via super-references), so I left that out for now. I will add this type of foreignkey handling when we have a real mapping-to-multiple-tables implementation in OJB (in which case I have to adapt the foreignkey handling anyway).
Tom
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
