Exception on commit when RevisionOnCollectionChange property is set
Description
I figured a different behaviour in Envers 5.0 compared to previous versions. It is related to the 2 settings 'RevisionOnCollectionChange' and 'GlobalWithModifiedFlag'. If both settings are set to true and the reference of one entity is changed, it ends up in an exception:
NHibernate.LazyInitializationException : Initializing[Envers5Bug.Person#1]-failed to lazily initialize a collection of role: Envers5Bug.Person.Cars, no session or session was closed
Since it is much harder to describe I prepared a very simple project which is revealing the problem. Please run Program.cs or Test.cs.
Environment
None
Attachments
1
Activity
Show:
RicoP October 23, 2017 at 8:34 AM
Edited
Thanks for fixing this bug so fast.
RicoP October 21, 2017 at 7:41 PM
Thanks, finally I managed to create a pull request
Roger October 21, 2017 at 7:31 PM
Yes, exactly. Thanks for pointing that out, Frederic.
Frédéric Delaporte October 21, 2017 at 11:01 AM
I would guess it is a like GitHub: you should not push directly to Envers repository, but to your own clone of the repository, then issue a PR from it toward Envers repository.
RicoP October 21, 2017 at 8:09 AM
Edited
Locally I created a branch with test, showing the problem. Unfortunately I cannot push the branch to the repository:
The authentication dialog of SourceTree it says that I entered the right credentials. Do I need special rights from your side? Sorry, I never used BitBucket before.
I figured a different behaviour in Envers 5.0 compared to previous versions. It is related to the 2 settings 'RevisionOnCollectionChange' and 'GlobalWithModifiedFlag'. If both settings are set to true and the reference of one entity is changed, it ends up in an exception:
NHibernate.LazyInitializationException : Initializing[Envers5Bug.Person#1]-failed to lazily initialize a collection of role: Envers5Bug.Person.Cars, no session or session was closed
Since it is much harder to describe I prepared a very simple project which is revealing the problem. Please run Program.cs or Test.cs.