Hi,
 
we are using NHibernate 1.2.1 behind a framework for a large application.
 
I was experimenting with NHib 4 now and found some of our unit tests going 
red with it. One of the problems is a bug in HQLQueryPlan. We have 
implemented the Any operator for a query as a select top 1 Id from Entity 
and if entity is an abstract class that is mapped per concrete class we get 
an exception because the IdentitySet is used for deduplicating the results 
and it does not work for value types. The part "if (needsLimit)" in 
HQLQueryPlan is the one I am writing about.
 
I had a look at the code and it obviously does not work. It will normally 
return 0 rows because of the "if (distinction.Add(result)) 
continue;". Running all the unit tests of NHibernate I saw that there also 
is no test coverage.
 
Now some thoughts and questions:
- is the distinction needed at all? In all other cases than when doing the 
in-memory rowselection, there is nothing done with deduplication so I 
assume it is also not required in this case
- maybe I could rewrite the code and provide a pull request
- if one of the translators already a bunch of data, the rowselection for 
the further selects could be adjusted to avoid unnecessary large result sets
- wouldn't it be worth refactoring the RowSelection class to use 
Nullable<int> instead of int with special NoValue constant of -1 to 
indicate nullness
 
CSharper
 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to