d95pari wrote:
The child table (also with a composite key) has a foreign key to the parent table's unique column (i.e. not the primary key).
How do I map this relationship i NHibernate?
In the parent mapping, can I do a one-to-many relationship from the unique column, to a compisite primary key in the child? And how do I map back in the child?
See the documentation:
http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html_single/#mapping-declaration-manytoone
taking special note of the property-ref attribute of the many-to-one mapping. This is what is used when you are not referencing the primary key.
As for the collection side, I'm drawing a bit of a blank. Handling composite keys is easy, just put multiple column elements in the key element. I'm not sure how you tell the collection to reference a different property. Maybe the property-ref is enough if you mark the collection as inverse? Give it a shot and see I suppose.