How would I do the following mapping?
I have two objects - a Company object which holds details of commercial companies and an Instrument object which holds details of financial instruments (equities and bonds) issued by companies. I have an association where a Company can issues one or more Instruments, and an Instrument can only ever belong to one Company.
On the database side the strcuture is more complex as I'm using legacy data structures. There is a many-to-many table between Companies and Instruments (lets call it company_instruments). In practice an Instrument can only ever be associated with one Company, although the data structure allows for multiple associations. There is currently client level code in old applications which means that the many-to-many table only ever lets an Instrument associate with one Company.
To get the hbm.xml mapping files I'm assuming I need to put some kind of association in the Company file, however I'm not sure how to do this with the additional many-to-many table in the way.
Any help appreacited.
Eric
|