I have a Voucher - POJO mapped to two tables. The first mapping assigns an entity name "voucherA" and maps the POJO to TableA. The second mapping uses "voucherB" as entity name and maps the POJO to TableB.
Now i have also a customer POJO mapped to TableC. This POJO references vouchers in a list.
<list name="vouchers" table="TableC_vouchers">
<key column="pid"/>
<list-index column="position" base="0"/>
<!-- how to do that right -->
<many-to-many column="voucher_id" entity-name="voucherB"/>
</list>
How do i properly map a list of many-to-many associations from customers to vouchers so that if a customer POJO is persisted, the Voucher entities are persisted to TableB if they don't exist there, instead of TableA? Can this be done? If not, what would a workaround look like so that vouchers used by customers are persisted to tableB? (TableA contains only available Vouchers, not the used ones)