Cannot use a sql custom loader with a composite ID

Description

See - http://forum.hibernate.org/viewtopic.php?t=934731

When specifying custom sql for loading a collection a QueryException is thrown when the the parameter binding class has a composite key.

As in the post above, commenting out the code in AbstractQueryImpl.VerifyParameters fixes the issue but breaks Legacy.FooBarTest.VerifyParameterPositionalMissing. Does the use case for this test still exist?

Hbm Example
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"
assembly="Foo.Bar.Interfaces"
namespace="Foo.Bar.Interfaces">
<class name="Item" table="Item">
<composite-id>
<key-property name="SellerId" access="field.camelcase-underscore" column="SellerId" />
<key-property name="Id" access="nosetter.camelcase-underscore" column="Id" />
</composite-id>

<many-to-one name="Seller" access="nosetter.camelcase-underscore" class="Seller" column="SellerId"
insert="false" update="false" />

<bag name="Alternates" access="nosetter.camelcase-underscore" generic="true">
<key>
<column name="SellerId" />
<column name="Id" />
</key>
<one-to-many class="Item" />
<loader query-ref="GetAlternateItems" />
</bag>
</class>

<sql-query name="GetAlternateItems">
<load-collection alias="alternateItem" role="Item.Alternates" />
EXEC GetAlternateItems ?, ?
</sql-query>
</hibernate-mapping>

Attached patch for fix if commenting out the code is determined to be the way to go.

Environment

None

Assignee

Unassigned

Reporter

Onur Gumus

Labels

None

Components

Fix versions

Priority

Minor
Configure