I am trying to convert a rather tricky mapping file configuration to annotation-based configuration. My first problem is a map-based @OneToMany association:
One of my classes, Report, has the following mapping:
Code:
<class name="Report" table="T_REPORT">
<id name="reportID" column="reportID" />
<!-- snipped irrelevant parts -->
<map name="equipmentStatsMap" table="T_EQUIPMENT_STATS">
<key column="reportID" />
<map-key-many-to-many column="EQUIPMENTTYPEID" />
<one-to-many class="EquipmentStats" />
</map>
</class>
Here is my annotation attempt:
Code:
public class Report implements Serializable {
private int reportId;
private Map<EquipmentType, EquipmentStats> equipmentStatsMap;
@Id
public int getReportId{
return this.reportId;
}
@OneToMany
@JoinTable(name = "T_EQUIPMENT_STATS", joinColumns= @JoinColumn(name="REPORTID"))
@org.hibernate.annotations.MapKey(columns={@Column(name="EQUIPMENTTYPEID")})
@MapKeyManyToMany(targetEntity = EquipmentType.class)
public Map<EquipmentType, EquipmentStats> getEquipmentStatsMap {
return this.equipmentStatsMap;
}
}
However, to make this more obnoxious, here is the mapping for the key for EquipmentStats:
Code:
<composite-id>
<key-many-to-one name="report" class="Report" column="REPORTID"/>
<key-many-to-one name="equipmentType" class="EquipmentType" column="EQUIPMENTTYPEID"/>
</composite-id>
The error being thrown is actually ORA-00972, Identifier Too Long, but I'm really thinking I've screwed up the mapping of the equipmentStatsMap.
Anyhelp would be GREATLY appreciated. The docs for mapping a map aren't making much sense to me under the current circumstances.
Jason