-
Notifications
You must be signed in to change notification settings - Fork 933
Bidirectional list fails if session only knows about child #2089
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Sure, I'm not talking about cascading or similar. Still, it's a bidirectional reference, and child know it's parent (and orderindex) in the domain model, so why shouldn't it be possible to save child without session knowing about parent, if that's what you mean? (Even with inverse=false it should work, but that's seldom/never used if ref is bidirectional I think?) |
This comment has been minimized.
This comment has been minimized.
Child knows only what's in its mapping. So it knows |
Agreed.
I don't. Why do you think I expect that? ;) We must be misunderstanding each other... |
This comment has been minimized.
This comment has been minimized.
Actually I dont. I expect Child's OrderIndex property and mapping to be used. |
This comment has been minimized.
This comment has been minimized.
@bahusoid Thanks for your time and discussion. Glad I could finally make myself a bit clearer :) |
According to this: https://stackoverflow.com/a/1758311/259946 bi-directional inverse list does not work at all. As I can see you have implemented a hack similar to the hack described in the SO answer. The NH-1338 has been closed as not an issue with weird explanation. Issues on hibernate's JIRA (HB-79, HHH-1165, HHH-3425) are also closed with the same explanation. (Here I'm really talking to myself trying to make sense of the mapping) |
@hazzik IIRC, "bi-directional inverse list does not work at all" was true a couple of years ago. Nowadays it is/should be supported as of 6.3.3 in documentation. Unfortunately, domain model is not part of those examples. The problem (if it is?) is probably the same as #1531. It only happens when merging entities. NHib then "detaches" the entities in the domain model from eachother and makes copies of the data. Due to this the references themself inside the model no longer points to the "correct" entities and the hack (if it is?) no longer works. |
I was talking about bidirectional inverse list without a special column. |
Thanks. This has now lives on master. Not sure though if we're going to fix this. |
When having a bidirectional inversed list, child seems to not fully "own" the collectionref when using session.Merge on child.
When running failing test, child will end up with order index -1 in db because when nhib's merge occur, the child is "unhooked" from its parent.
Probably closely related to #1531.