You can use an anonymous tag for the productGroupId field. The anonymous tag lets you represent the foreign key of your database within OJB without having to declare it in your java classes. There is an example on the anonymous tag within the XDoclet OJB module documentation.
-----Original Message----- From: Michael Pearce [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 8:27 PM To: OJB Users List Subject: XDoclet References need separate ID field? Hello, I am new to OJB and am using the OJB XDoclet. I have a foreign key relationship between two classes. In the class making the reference, there must be a field specified for the ID of the foreign key - but I have no need for this field (since I have a reference to the object itself). Is it possible to not include this field? (OJB XDoclet does not produce the correct schema if this ID field is removed.) Is this a limitation of the OJB XDoclet or OJB itself? This is illustrated in the OJB XDoclet in the foreign key reference example. Why does one need to have a reference to both productGroup and productGroupID? /** * @ojb.reference class-ref="org.apache.ojb.broker.ProductGroup" * foreignkey="productGroupId" * @ojb.documentation this is the reference to an articles productgroup * @ojb.attribute attribute-name="color" * attribute-value="red" * @ojb.attribute attribute-name="size" * attribute-value="tiny" */ protected InterfaceProductGroup productGroup; /** * @ojb.field */ protected int productGroupId; -mike --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
