Hi,
I have a similar situation, I want to exclude some of the inverse sets from my mapping files, like the one below:
Code:
<set name="rumWayLineMultiples" inverse="true">
<key>
<column name="ID_HIERACHY_LISTE" precision="22" scale="0" not-null="true" />
</key>
<one-to-many class="com.test.model.RumWayLineMultiple" />
</set>
So in my RevengStrategy.java I've overridden the
excludeForeignKeyAsCollection() method like this :
Code:
public boolean excludeForeignKeyAsCollection(String FK, TableIdentifier tableIdentifier, List list, TableIdentifier tableIdentifier1, List list1) {
boolean collectionInverse = isForeignKeyCollectionInverse(FK, tableIdentifier, list, tableIdentifier1, list1);
if(collectionInverse) {
return true;
}
return false;
}
But this doesn't work quite the way I expected. It removes all the <sets> but it also removes some <many-to-one> mappings.
There is another method
excludeForeignKeyAsManytoOne() and I thought that this handles <many-to-one>.
Any ideas why it does that ? And is it possible to exclude only certain <sets> ? I mean if a mapping file has 3 <sets>, can I tell excludeForeignKeyAsCollection() based on the foreign key or tables identifiers exactly which <sets> I want excluded ?
Thanks