I have an object that has two foreign keys and is held in a
List of one of its parent tables. Here is the example:
(obviously this is pseudo code)
class Invoice {
Contact shipper;
Contact buyer;
List shipperNotes; // List of Note objects
List buyerNotes; // List of Note objects
}
I cannot simply attach a Note object to an Invoice without
specifing whether the Note is owned by the shipper or buyer
Contact. The DB table for Note is:
NOTE
----
ID INTEGER (PK)
NOTE VARCHAR(8192)
...
OWNERID INTEGER (FK to Contact table)
INVOICEID INTEGER (FK to Invoice table)
here is an excerpt from my repository.xml inside the Invoice def:
<collection-descriptor
name="buyerNotes"
element-class-ref="model.Note"
auto-update="true"
auto-delete="true"
orderby="TIMECREATED"
sort="ASC"
>
<inverse-foreignkey field-ref="invoiceId"/>
<!-- <inverse-foreignkey field-ref="buyerId"/> -->
</collection-descriptor>
I'm at a loss how to describe to OJB how it should fill the Note's
InvoiceId with the Id from the Invoice created _and_ the buyerId
with the Id from the Contact object of the buyer. It would seem
the <inverse-foreignkey> tag would need two attributes, a field-ref
telling it the target field to fill and another attribute to tell
it the _source_ field.
I searched the email archives and came up empty. Any ideas? Should
I have designed the database schema differently?
Thanks,
-tim
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]