It's a bug in NHibernate. There are a few bug entries in the NHibernate issue tracker for it, e.g.: https://nhibernate.jira.com/browse/NH-2500
NHibernate LINQ : Why is a query using the incorrect char value if I repeat the call?
-
30-05-2022 - |
Domanda
Using NHibernate 3.3.1.4000 / .Net 3.5
I have an object I'm mapping to an existing Oracle 10g database :
public MyJob : LegacyOracleDbObjects {
public virtual int JobID { get; protected set; }
public virtual char Status { get; protected set; }
}
And a mapping :
public MyJobMap()
{
Table("JOB");
Id(x => x.JobID).Column("JOB_ID");
Map(x => x.Status).Column("STATUS");
}
And a LINQ query :
char selected_status = 'W'
query = from job in query
where job.Status == selected_status
select job;
Which works fine the first time I run it, but if I then 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' (i.e. the first value for status) into the database query. I've checked the selected_status value passed into the query, and it looks fine, but the SQL query always contains the original value for selected_status, unless I add a filter for ID, in which case it then uses that status for all subsequent requests regardless of what I pass in.
Any idea why this char query parameter is behaving like this?
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow