I have the following classes and I am using "table-per-subclass" mapping strategy (as defined in the documentation).
Class Hierarchy
============
IPayableFee (interface)
-> ClassFee (subclass inheriting IPayableFee)
-> OtherFee (subclass inheriting IPayableFee)
Database Tables
=============
PayableFee (PK: intIdPFee)
ClassFee (PK: intIdCFee. also an FK one-to-one linked to intIdPFee of PayableFee)
OtherFee (PK: intIdOFee. also an FK one-to-one linked to intIdPFee of PayableFee)
Hibernate Mapping document
====================
<class name="IPayableFee" table="PayableFee">
<id name="Id" column="intIdPFee" type="Int64">
<generator class="identity"/>
</id>
....other properties of IPayableFee
<joined-subclass name="ClassFee" table="ClassFee" >
<key column="intIdCFee"/>
....other properties of ClassFee
</joined-subclass>
<joined-subclass name="OtherFee" table="APAS_OtherFee" >
<key column="intIdOFee" />
....other properties of Other Fee
</joined-subclass>
</class>
Now, i have another class (PaymentAdvice) that want to contain a collection (IDictionary indexed by Id) of IPayableFee. So, i define the collecition mapping like this
<map name="PayableFees" cascade="none" >
<key column="intIdPFee" ></key>
<index column="intIdPFee" type="Int64"/>
<one-to-many class="IPayableFee" not-found="exception"/>
</map>
The Hibernate is throwing this error
Repeated column in mapping for collection: PaymentAdvice.PayableFees column: intIdPFee ...
I have read the documentation... It only specify how to do polymorphic association using many-to-one mapping. But, mine is a collection so i cannot use many-to-one and I have defined the mapping according to the guidelines in the collection mapping chapter... I dunno what's wrong. can anyone help me? thanks
|