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

Add test for entity with lazy property #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ogorodnikovInfopulse
Copy link

I get an error after updating NHibernate from 5.1.3 to 5.2.5

This error is during changes not lazy property in another session

@RogerKratz
Copy link
Collaborator

Can you paste the exception/stack trace here please?

@ogorodnikovInfopulse
Copy link
Author

Message: NHibernate.PropertyValueException : Error dehydrating property value for NHibernate.Envers.Tests.NetSpecific.Integration.Lazy.EntityWithLazyProp_AUD.LazyProp
----> System.InvalidCastException : Unable to cast object of type 'NHibernate.Intercept.UnfetchedLazyProperty' to type 'System.String'.

@ogorodnikovInfopulse
Copy link
Author

at NHibernate.Persister.Entity.AbstractEntityPersister.Dehydrate(Object id, Object[] fields, Object rowId, Boolean[] includeProperty, Boolean[][] includeColumns, Int32 table, DbCommand statement, ISessionImplementor session, Int32 index)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Object obj, ISessionImplementor session)
at NHibernate.Action.EntityInsertAction.Execute()
at NHibernate.Engine.ActionQueue.InnerExecute(IExecutable executable)
at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
at NHibernate.Engine.ActionQueue.ExecuteActions()
at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
at NHibernate.Impl.SessionImpl.Flush()
at NHibernate.Envers.Synchronization.AuditProcess.DoBeforeTransactionCompletion() in C:\GitHub\nhibernate-envers\Src\NHibernate.Envers\Synchronization\AuditProcess.cs:line 166

@RogerKratz
Copy link
Collaborator

I get an error after updating NHibernate from 5.1.3 to 5.2.5

Do you mean that this test case worked in NHibernate + Envers before? Haven't looked closely but AFAIK, nothing regarding lazy props have changed recently. Could it be a change in NHib core that caused this maybe?

@ogorodnikovInfopulse
Copy link
Author

We have somthing like on this image
image

Left - NHib 5.1.3 and Rigth - NHib 5.2.5
Maybe it's a bug in NBib Core, but I cannot reproduce this error here, it's reproduced only with Envers.

And yes - it workes before

@RogerKratz
Copy link
Collaborator

Maybe @hazzik has some input if this is a known bug or breaking change in later versions of nhib core?

@ogorodnikovInfopulse
Copy link
Author

Do you have any news?

@RogerKratz
Copy link
Collaborator

No, I don't know. Lazy properties are handled just like normal properties in Envers.

Let's say you have an entity with this property...
<property name="LazyProp" lazy="true" />

...the audited entity that Envers creates behind the scenes have this corresponding property...
<property name="LazyProp" />

Nothing regarding this has been changed recently AFAIK. Guess the problem occurs when "moving" data from normal entity's lazy property to audited entity's non lazy property. But that's just a guess, cannot reproduce it.

@ogorodnikovInfopulse
Copy link
Author

Is it ok if I get ProxyForFieldInterceptor using NHib core, as it is in screenshot?

@bahusoid
Copy link
Member

bahusoid commented Jun 4, 2019

I'm not sure what the problem is but I believe the behavior you see is due to nhibernate/nhibernate-core#1709.
So yes changed type for proxy is expected behavior in 5.2 for entities with lazy properties.

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

Successfully merging this pull request may close these issues.

3 participants