Hello all,
I have filed a couple of bugs in Jira that both relate to the processing of
polymorphic queries:
- NH-2959 deals with ArgumentOutOfRangeExceptions in the processing of
polymorphic queries in MultiQuery/MultiCriteria/Future scenarios.
- NH-2060 focuses on the incorrect processing of Criteria and HQL
queries when using explicit entity names and multiple mappings exists for
one and the same entity class, but with different entity names. The problem
in this scenario is that in queries with an explicit entity name the entity
name is ignored and the results contain all entities of the same entity
class. For example, when using mapping
<hibernate-mapping>
<class name="Entity" entity-name="BarCode" table="barcodes">
<id name="Id" generator="guid.comb" />
<property name="Name" />
</class>
<class name="Entity" entity-name="FooCode" table="foocodes">
<id name="Id" generator="guid.comb" />
<property name="Name" />
</class>
</hibernate-mapping>
the following queries
session.CreateQuery("from BarCode").List();
session.CreateCriteria("BarCode").List();
return entities from both the foocodes and barcodes tables, whereas they
should only return entities from the barcodes table.
For both issues pull requests have been created. The bug in NH-2959 has
been encountered by others (see for example
http://stackoverflow.com/questions/4619863/error-executing-multi-criteria-exception-when-using-subclasses-in-nhibernate)
and probably has the highest priority. However it would be great if NH-2060
could be merged as well.
Regards,
Gerke.