I'm trying to generate .hbm.xml files with many-to-many elements with "where" attribute, e.g.
Code:
<set name="localisedDescription" inverse="false" table="calls_ls">
<key>
<column name="call_id" not-null="true" />
</key>
<many-to-many entity-name="LocalisedString" [b]where="type_qname='cms:localisedDescription'"[/b]>
<column name="ls_id" not-null="true" />
</many-to-many>
</set>
The problem is in set.hbm.ftl, lines 24-25:
Code:
<many-to-many
entity-name="${property.getValue().getElement().getReferencedEntityName()}"> <#-- lookup needed classname -->
should read:
Code:
<many-to-many
entity-name="${property.getValue().getElement().getReferencedEntityName()}"
<#if property.value.manyToManyWhere?exists>
where="${property.value.manyToManyWhere}"
</#if>
>
The problem may apply to other Collection types.
Hope this is useful. Can supply patch if required.
Dominic