9

I'm learning Fluent Nhibernate and my question is:
What does Inverse mean? I read that it means that the other side of the relationship is responsible for the saving, and so does Cascade,

Can someone please explain what are the differences between them? Please explain in details because I'm a newbie at NH.

gdoron
  • 147,333
  • 58
  • 291
  • 367

2 Answers2

1

Have a look at this text (link down, here's a mirror on archive.org), the "inverse" attribute is explained in detail.

The different cascade options are well explained by Ayende himself in his blog.

A good and recommended read is "NHibernate in Action", while not an easy text, this will cover a lot of your questions.

CB-Dan
  • 1,718
  • 2
  • 16
  • 29
kay.herzam
  • 3,053
  • 3
  • 26
  • 37
  • I'm sorry but I didn't understand how does inverse = false works I just saw it does stupid things but what is the explanations for it. And when inverse= false is good? Thanks alot! – gdoron Feb 03 '11 at 12:50
  • Inverse just defines which end of the relationship "owns" it. With set to false (on the one-side), the parent owns the relationship. In most cases, this doesn't make sense and also results in additional, unnecessary SQL statements. – kay.herzam Feb 03 '11 at 14:34
  • The first link is down at the moment. Here's a mirror on archive.org https://web.archive.org/web/20080415101633/http://simoes.org/docs/hibernate-2.1/155.html – CB-Dan Apr 22 '15 at 20:06
  • As the link is down and an archive link is given (which is very slow to load), including the text in the answer would help. – Ashraf Alam Mar 16 '16 at 10:38
0

I found an explanation when Inverse = false is necessary. If I want a Parent with collection of "children" and in the child object there won't be a reference to the parent.
so you do Has many on the parent add inverse = false and not adding the reference in the child.

gdoron
  • 147,333
  • 58
  • 291
  • 367