I am trying to construct a mapping using a filter with a parameter using a collection, AND a schema name. The collection works fine, but I can't parameterize the schema name.
Code:
<class name="Product" table="product">
<id name="serialNumber" column="product_serial_number"/>
<set name="parts">
<key column name="product_serial_number" not-null="true"/>
<one-to-many class="Part"/>
<filter name="partFilter" condition="part_type in (select pg.part_type from :schema_name.part_group as pg where pg.group in(:groups))"/>
</set>
</class>
<filter-def name="partFilter">
<filter-param name="schema_name" type="string"/>
<filter-param name="groups" type="string"/>
</filter-def>
Unsurprisingly, this will not work, as the :schema_name can't be declared as a parameter. I get the following error:
Code:
java.lang.InternalError: Unable to locate type for filter parameter
org.hibernate.impl.SessionImpl.getFilterParameterType(SessionImpl.java:1065)
Is there another way for me to filter my collections data such that the schema name is set at runtime?
thanks!