NHibernate LINQ: Why is the query using the wrong char value if I repeat the call?

Using NHibernate 3.3.1.4000/.Net 3.5

I have an object that I map to an existing Oracle 10g database:

public MyJob : LegacyOracleDbObjects { public virtual int JobID { get; protected set; } public virtual char Status { get; protected set; } } 

And display:

 public MyJobMap() { Table("JOB"); Id(x => x.JobID).Column("JOB_ID"); Map(x => x.Status).Column("STATUS"); } 

And LINQ query:

 char selected_status = 'W' query = from job in query where job.Status == selected_status select job; 

Which works fine on first run, but if I try to run the query:

 char selected_status = 'S' query = from job in query where job.Status == selected_status select job; 

NHibernate still passes the value "W" (that is, the first status value) to the database request. I checked the selected_status value passed to the query and it looks good, but the SQL query always contains the original value for selected_status, unless I add a filter for the ID, in which case it will use this status for all subsequent queries regardless of of what I went through.

Any idea why this char request parameter behaves as follows?

+4
source share
1 answer

This is a mistake in NHibernate. There are several error entries in the error log for NHibernate, for example: https://nhibernate.jira.com/browse/NH-2500

+3
source

Source: https://habr.com/ru/post/1482096/


All Articles