Inverse option for 1:many relationships
Posted: Thu 19 Jan 2012 16:17
Just a quick question, hopefully.
When you define a one-to-many relationships, why is there an option to disable "inverse" on the many-side of the relationship?
As far as my understanding of NH, with a one-to-many relationship resulting in two "relationship definitions" in terms of the generated HBM mappings, the "inverse" option should always be used on the reverse relationship, since, the way the schema is generated, the many-side is always the "owner" of that relationship, since that's where the foreign key is located in the schema.
Is there a real use-case for a one-to-many where the many-side is not "inverse"?
The only use-case I can think of, is a one-to-many where the one-side isn't generated.
If that is the only use-case, why doesn't the "generate" setting simply drive the "inverse" property? At least, it could automatically set the "inverse" property to the most likely default, or not?
When you define a one-to-many relationships, why is there an option to disable "inverse" on the many-side of the relationship?
As far as my understanding of NH, with a one-to-many relationship resulting in two "relationship definitions" in terms of the generated HBM mappings, the "inverse" option should always be used on the reverse relationship, since, the way the schema is generated, the many-side is always the "owner" of that relationship, since that's where the foreign key is located in the schema.
Is there a real use-case for a one-to-many where the many-side is not "inverse"?
The only use-case I can think of, is a one-to-many where the one-side isn't generated.
If that is the only use-case, why doesn't the "generate" setting simply drive the "inverse" property? At least, it could automatically set the "inverse" property to the most likely default, or not?