Skip to content
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

Incorrect audit table insert on tables with tree structure #18

Closed
wojtek-abakus opened this issue Jul 23, 2019 · 4 comments
Closed

Incorrect audit table insert on tables with tree structure #18

wojtek-abakus opened this issue Jul 23, 2019 · 4 comments

Comments

@wojtek-abakus
Copy link
Contributor

Hello.

I have a problem with envers when an audited table has a tree structure.
When I insert a row without any parent it inserts correctly to an audit table with revision type 0 (Added).
Then I try to insert a child row with an ID pointing to parent row (by creating an empty entity with only ID set, it works normallny with nHibernate).

The result is that Envers tries to insert an audit table row with with revision type 1 (Modified) that corresponds to the parent row with all the fields set to null...
It's very strange, but when I comment out the HasMany mapping it works ok.

I have made a sample project to show that behavior, it crashes because one of the fields is set to be not null.

EnversTest.zip

@RogerKratz
Copy link
Collaborator

Can you please create a pull request with a failing test following the structure of tests in https://github.com/nhibernate/nhibernate-envers/tree/master/Src/NHibernate.Envers.Tests/NetSpecific/Integration

Thanks.

wojtek-abakus added a commit to ABAKUS-ST/nhibernate-envers that referenced this issue Jul 25, 2019
wojtek-abakus added a commit to ABAKUS-ST/nhibernate-envers that referenced this issue Jul 25, 2019
@wojtek-abakus
Copy link
Contributor Author

Hello, any chance for a fix of this issue ? Or could you be so kind and point me some workaround ?

@RogerKratz
Copy link
Collaborator

A "workaround" would be to set real TreeEntity instance as parent instead of creating a new one and set its Id to the original one.

@RogerKratz
Copy link
Collaborator

Closing this one, leave corresponding PR #19 open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants