You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I've recently upgraded my application from .NET 3.1 to 6.0. Version of NHibernate was not changed - it was 5.2.5.0.
I've change also logging method. Previously NHibernate was logging to Common.Logging via NHibernate.Logging. After upgrade I've installed and configured NHibernate.Extensions.Logging
Simple tests confirmed that change was successfully implemented.
However after some time we've found that queries contained join work incorrectly. For JoinEntityAlias method (as in screenshot) we've got incorrect syntax - part of where statement was put into the from clause. Message was "could not execute query".
I've converted JoinEntityAlias into proper Linq query. Then we've obtained message "undefined join type".
We have other types of specyfying joins but I haven't tested it.
After removing Nuget package with NEL everything was back to normal.
I've recompiled NEL from sources referencing our local copy of NHibernate.dll and then used this instead of oryginal NEL NuGet package. Everything behaves as expected.
To Reproduce
Steps to reproduce the behavior:
Install NHibernate version 5.2.5.0 . Create a query with JoinEntityAlias.
Then install NHibernate.Extensions.Logging version 2.3.1 Nuget.
Add
var loggerFactory = app.ApplicationServices.GetRequiredService<Microsoft.Extensions.Logging.ILoggerFactory>();
NHibernateLogger.SetLoggersFactory(new MicrosoftLoggerFactory(loggerFactory));
in Configure method in Startup class.
Query will not run as before.
Expected behavior
Logging should never change application behavior. Especially it should not change generated queries.
Screenshots
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
I also could not believe in this. But confirmation was simple - by adding/removing NuGet I got error or not. Fully repeatable.
I cannot imagine what mechanism would affect NHibernate to generates queries differently.
I've reverted to NEL 2.3.1. it appears that build folder contains NHibernate.dll version 5.3.11.0 .
I had my NH 5.2 library taken from local libs folder and NEL from NuGet. Probably NEL took another NH from net and overridden local version.
So my code was compiled with 5.2 and run with 5.3 and this is the source of problems.
I should have NHibernate from Nuget. Probably then NHibernate library would not be overridden.
There is no particular reason to not have NH from NuGet. It is just because project was started long ago.
Anyway it was very surprising behavior.
I do not know if reverting to NH 5.2 with NEL 2.3.1 is good decision. In 2.3.1 you've specified that it is targeted for NH 2.3+. So it appears that I've made a mistake.
The only thing we can do is to describe consequences if preconditions are not fulfilled. And this thread is just that.
Describe the bug
I've recently upgraded my application from .NET 3.1 to 6.0. Version of NHibernate was not changed - it was 5.2.5.0.
I've change also logging method. Previously NHibernate was logging to Common.Logging via NHibernate.Logging. After upgrade I've installed and configured NHibernate.Extensions.Logging
Simple tests confirmed that change was successfully implemented.
However after some time we've found that queries contained join work incorrectly. For JoinEntityAlias method (as in screenshot) we've got incorrect syntax - part of where statement was put into the from clause. Message was "could not execute query".
I've converted JoinEntityAlias into proper Linq query. Then we've obtained message "undefined join type".
We have other types of specyfying joins but I haven't tested it.
After removing Nuget package with NEL everything was back to normal.
I've recompiled NEL from sources referencing our local copy of NHibernate.dll and then used this instead of oryginal NEL NuGet package. Everything behaves as expected.
To Reproduce
Steps to reproduce the behavior:
Install NHibernate version 5.2.5.0 . Create a query with JoinEntityAlias.
Then install NHibernate.Extensions.Logging version 2.3.1 Nuget.
Add
var loggerFactory = app.ApplicationServices.GetRequiredService<Microsoft.Extensions.Logging.ILoggerFactory>();
NHibernateLogger.SetLoggersFactory(new MicrosoftLoggerFactory(loggerFactory));
in Configure method in Startup class.
Query will not run as before.
Expected behavior
Logging should never change application behavior. Especially it should not change generated queries.
Screenshots
![image002](https://user-images.githubusercontent.com/131632/212475412-00b65d31-73dc-42c7-a8c5-c9d6ddde06cb.png)
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: